File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 420
420
)
421
421
end
422
422
423
+ @testset " testitem with `default_imports`" begin
424
+ ti = @testitem " default_imports" default_imports= true _run= false begin
425
+ @test @isdefined Test
426
+ @test @isdefined ReTestItems
427
+ end
428
+ @test ti. default_imports == true
429
+ res = ReTestItems. runtestitem (ti)
430
+ @test n_passed (res) == 2
431
+
432
+ ti = @testitem " no_default_imports" default_imports= false _run= false begin
433
+ # use `@assert` since we cannot use `@test`
434
+ @assert ! (@isdefined Test)
435
+ @assert ! (@isdefined ReTestItems)
436
+ end
437
+ @test ti. default_imports == false
438
+ ReTestItems. runtestitem (ti) # check `@assert` not triggered
439
+
440
+ @test_throws " `default_imports` keyword must be passed a `Bool`" (
441
+ @eval @testitem " Bad" default_imports= 1 begin
442
+ @test true
443
+ end
444
+ )
445
+ end
446
+
447
+ @testset " testitem with unrecognised keyword" begin
448
+ @test_throws " unknown `@testitem` keyword arg `quux`" (
449
+ @eval @testitem " Bad" quux= 1 begin
450
+ @test true
451
+ end
452
+ )
453
+ end
454
+
455
+ @testset " testitem without a body" begin
456
+ @test_throws " expected `@testitem` to have a body" (@eval @testitem " wrong" )
457
+ @test_throws " expected `@testitem` to have a body" (@eval @testitem " wrong" @test 1 == 1 )
458
+ @test_throws " expected `@testitem` to have a body" (@eval @testitem " wrong" let @test 1 == 1 end )
459
+ @test_throws " expected `@testitem` to have a body" (@eval @testitem " wrong" quote @test 1 == 1 end )
460
+ end
461
+
462
+
423
463
#=
424
464
NOTE:
425
465
These tests are disabled as we stopped using anonymous modules;
You can’t perform that action at this time.
0 commit comments