@@ -18,7 +18,7 @@ a[1,1,1,1,1] = 10
18
18
19
19
@test rand () != rand ()
20
20
21
- # Test printing of result types
21
+ # Test printing of Pass results
22
22
# Pass - constant
23
23
@test contains (sprint (show, @test true ), " Expression: true" )
24
24
# Pass - expression
@@ -28,6 +28,31 @@ a[1,1,1,1,1] = 10
28
28
@test contains (sprint (show, @test_throws ErrorException error ()),
29
29
" Thrown: ErrorException" )
30
30
31
+ # Test printing of Fail results
32
+ type NoThrowTestSet <: Base.Test.AbstractTestSet
33
+ results:: Vector
34
+ NoThrowTestSet (desc) = new ([])
35
+ end
36
+ Base. Test. record (ts:: NoThrowTestSet , t:: Base.Test.Result ) = (push! (ts. results, t); t)
37
+ Base. Test. finish (ts:: NoThrowTestSet ) = ts. results
38
+ fails = @testset NoThrowTestSet begin
39
+ # Fail - wrong exception
40
+ @test_throws OverflowError error ()
41
+ # Fail - no exception
42
+ @test_throws OverflowError 1 + 1
43
+ # Fail - const
44
+ @test false
45
+ # Fail - comparison
46
+ @test 1 + 1 == 2 + 2
47
+ end
48
+ for i in 1 : 4
49
+ @test isa (fails[i], Base. Test. Fail)
50
+ end
51
+ @test contains (sprint (show, fails[1 ]), " Thrown: ErrorException" )
52
+ @test contains (sprint (show, fails[2 ]), " No exception thrown" )
53
+ @test contains (sprint (show, fails[3 ]), " Evaluated: false" )
54
+ @test contains (sprint (show, fails[4 ]), " Evaluated: 2 == 4" )
55
+
31
56
# Test printing of a TestSetException
32
57
tse_str = sprint (show, Test. TestSetException (1 ,2 ,3 ))
33
58
@test contains (tse_str, " 1 passed" )
0 commit comments