@@ -17,7 +17,7 @@ function naive_sum(xs)
17
17
return s
18
18
end
19
19
20
- f (x) = x+ y
20
+ foo (x) = x+ y
21
21
22
22
function f2 (x)
23
23
foo = y
@@ -63,7 +63,7 @@ my_stable_add_undecorated(y) = my_add(y)
63
63
ws = Traceur. warnings (() -> naive_sum ([1.0 ]))
64
64
@test warns_for (ws, " assigned" , " returns" )
65
65
66
- ws = Traceur. warnings (() -> f (1 ))
66
+ ws = Traceur. warnings (() -> foo (1 ))
67
67
@test warns_for (ws, " global" , " dispatch" , " returns" )
68
68
69
69
ws = Traceur. warnings (() -> f2 (1 ))
@@ -100,5 +100,23 @@ my_stable_add_undecorated(y) = my_add(y)
100
100
@test_nowarn @check my_add (1 )
101
101
@test_throws AssertionError @check my_stable_add (1 )
102
102
@test_throws AssertionError @check my_stable_add_undecorated (1 ) nowarn= [my_stable_add_undecorated]
103
+ @test_throws AssertionError @check my_stable_add_undecorated (1 ) nowarn= :all
104
+ function bar (x)
105
+ x > 0 ? 1.0 : 1
106
+ end
107
+ @test @check (bar (2 )) == 1.0
108
+ @test @check (bar (2 ), maxdepth= 100 ) == 1.0
109
+ @test @check (bar (2 ), nowarn= :none ) == 1.0
110
+ @test @check (bar (2 ), nowarn= :none , maxdepth= 100 ) == 1.0
111
+ @test @check (bar (2 ), nowarn= []) == 1.0
112
+ @test @check (bar (2 ), nowarn= [], maxdepth= 100 ) == 1.0
113
+ @test @check (bar (2 ), nowarn= Any[]) == 1.0
114
+ @test @check (bar (2 ), nowarn= Any[], maxdepth= 100 ) == 1.0
115
+ @test_throws AssertionError @check (bar (2 ), nowarn= [bar])
116
+ @test_throws AssertionError @check (bar (2 ), nowarn= [bar], maxdepth= 100 )
117
+ @test_throws AssertionError @check (bar (2 ), nowarn= Any[bar])
118
+ @test_throws AssertionError @check (bar (2 ), nowarn= Any[bar], maxdepth= 100 )
119
+ @test_throws AssertionError @check (bar (2 ), nowarn= :all )
120
+ @test_throws AssertionError @check (bar (2 ), nowarn= :all , maxdepth= 100 )
103
121
end
104
122
end
0 commit comments