11@testset " NO_FIELDS" begin
2- @test (@test_deprecated NO_FIELDS) isa NoTangent
2+ # Following doesn't work because of some deprecate_binding weirdness with not printing
3+ # @test (@test_deprecated NO_FIELDS) isa NoTangent
4+ # So just test it gives the old behavour
5+ @test NO_FIELDS isa NoTangent
36end
47
58@testset " extern" begin
6- @test extern (@thunk (3 )) == 3
7- @test extern (@thunk (@thunk (3 ))) == 3
9+ @test ( @test_deprecated extern (@thunk (3 ) )) == 3
10+ @test ( @test_deprecated extern (@thunk (@thunk (3 ) ))) == 3
811
9- @test extern (Tangent {Foo} (x= 2.0 )) == (;x= 2.0 )
10- @test extern (Tangent {Tuple{Float64,}} (2.0 )) == (2.0 ,)
11- @test extern (Tangent {Dict} (Dict (4 => 3 ))) == Dict (4 => 3 )
12+ @test ( @test_deprecated extern (Tangent {Foo} (x= 2.0 ) )) == (;x= 2.0 )
13+ @test ( @test_deprecated extern (Tangent {Tuple{Float64,}} (2.0 ) )) == (2.0 ,)
14+ @test ( @test_deprecated extern (Tangent {Dict} (Dict (4 => 3 ) ))) == Dict (4 => 3 )
1215
1316 # with differentials on the inside
14- @test extern (Tangent {Foo} (x= @thunk (0 + 2.0 ))) == (;x= 2.0 )
15- @test extern (Tangent {Tuple{Float64,}} (@thunk (0 + 2.0 ))) == (2.0 ,)
16- @test extern (Tangent {Dict} (Dict (4 => @thunk (3 )))) == Dict (4 => 3 )
17+ @test ( @test_deprecated extern (Tangent {Foo} (x= @thunk (0 + 2.0 ) ))) == (;x= 2.0 )
18+ @test ( @test_deprecated extern (Tangent {Tuple{Float64,}} (@thunk (0 + 2.0 ) ))) == (2.0 ,)
19+ @test ( @test_deprecated extern (Tangent {Dict} (Dict (4 => @thunk (3 ) )))) == Dict (4 => 3 )
1720
1821 z = ZeroTangent ()
19- @test extern (z) === false
22+ @test (@test_deprecated extern (z)) === false
23+
24+ # @test_throws doesn't play nice with `@test_deprecated` so have to be loud
2025 dne = NoTangent ()
2126 @test_throws Exception extern (dne)
22- E = ChainRulesCore . NotImplementedException
23- @test_throws E extern (ni)
27+ ni = @not_implemented ( " no " )
28+ @test_throws ChainRulesCore . NotImplementedException extern (ni)
2429end
2530
2631
2732@testset " Deprecated: calling thunks should call inner function" begin
28- @test_deprecated (@thunk (3 ))() == 3
29- @test_deprecated (@thunk (@thunk (3 )))() isa Thunk
33+ @test ( @ test_deprecated (@thunk (3 ))() ) == 3
34+ @test ( @ test_deprecated (@thunk (@thunk (3 )))() ) isa Thunk
3035end
36+
37+ @testset " Deprecated: Inplacable Thunk argument order" begin
38+ @test (@test_deprecated InplaceableThunk (@thunk ([1 ]), x-> x.+ = 1 )) isa InplaceableThunk
39+ end
0 commit comments