Skip to content

Commit ca519c6

Browse files
committed
Add tests and fix implementation
1 parent 1ae249d commit ca519c6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/testers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function test_rrule(
196196
# and define helper closure over fkwargs
197197
call(f, xs...) = f(xs...; fkwargs...)
198198

199-
@testset "test_rrule: $f on $(_string_typeof(args))" begin
199+
@testset "$(testset_name)" begin
200200

201201
# Check correctness of evaluation.
202202
primals_and_tangents = auto_primal_and_tangent.((f, args...))

test/testers.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,4 +725,15 @@ end
725725
test_frule(f_vec_of_tuples, x_tuples)
726726
test_rrule(f_vec_of_tuples, x_tuples)
727727
end
728+
@testset "check passing of testset_name kwarg" begin
729+
name = "my test name"
730+
double(x) = 2x
731+
@scalar_rule(double(x), 2)
732+
x = test_scalar(double, 2.1; testset_name=name)
733+
@test x.description == name
734+
x = test_frule(identity, 1.0; testset_name=name)
735+
@test x.description == name
736+
x = test_rrule(identity, 1.0; testset_name=name)
737+
@test x.description == name
738+
end
728739
end

0 commit comments

Comments
 (0)