File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -131,23 +131,27 @@ end
131131 test_do_block ()
132132 end
133133
134+ @testset " Error upon misuse" begin
135+ @gensym A
136+ @test_throws (
137+ " @__FUNCTION__ can only be used within a function" ,
138+ @eval (module $ A; @__FUNCTION__ ; end )
139+ )
140+ end
141+
134142 @testset " Callable structs throw error" begin
143+ @gensym A
144+ @eval module $ A
135145 struct CallableStruct{T}
136146 val:: T
137147 end
138148 function (c:: CallableStruct )()
139149 return @__FUNCTION__
140150 end
151+ end
152+ @eval using .$ A: CallableStruct
141153 c = CallableStruct (5 )
142- @test_throws UndefVarError c ()
143- end
144-
145- @testset " Error upon misuse" begin
146- @gensym A
147- @test_throws (
148- " @__FUNCTION__ can only be used within a function" ,
149- @eval (module $ A; @__FUNCTION__ ; end )
150- )
154+ @test_throws " @__FUNCTION__ can only be used within a function" c ()
151155 end
152156 end
153157end
You can’t perform that action at this time.
0 commit comments