From 1263dd46d38315129f18b0a591433a9dcf68d63d Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Sun, 10 Jun 2018 16:54:13 +0300 Subject: [PATCH] Test the test --- stdlib/Test/test/runtests.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/Test/test/runtests.jl b/stdlib/Test/test/runtests.jl index 41688cc9aa7324..758de92a953c02 100644 --- a/stdlib/Test/test/runtests.jl +++ b/stdlib/Test/test/runtests.jl @@ -491,12 +491,19 @@ end # test @inferred function uninferrable_function(i) - q = [1, "1"] + q = (1, "1") return q[i] end - @test_throws ErrorException @inferred(uninferrable_function(1)) @test @inferred(identity(1)) == 1 +function uninferrable_small_union(i) + q = (1, nothing) + return q[i] +end +@test @inferred(uninferrable_small_union(1), Nothing) === 1 +@test @inferred(uninferrable_small_union(2), Nothing) === nothing +@test_throws ErrorException @inferred(uninferrable_small_union(1), Missing) +@test_throws ErrorException @inferred(uninferrable_small_union(2), Missing) # Ensure @inferred only evaluates the arguments once inferred_test_global = 0