Skip to content

Commit

Permalink
Test the test
Browse files Browse the repository at this point in the history
  • Loading branch information
haampie committed Jun 10, 2018
1 parent 2cc57f8 commit 1263dd4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions stdlib/Test/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1263dd4

Please sign in to comment.