|
11 | 11 | @test 2 == 2 |
12 | 12 | end |
13 | 13 | flattened_testsets = TestReports.flatten_results!(ts) |
| 14 | + @test flattened_testsets isa Vector |
14 | 15 | @test length(flattened_testsets) == 1 |
15 | 16 | @test all(ts -> ts isa AbstractTestSet, flattened_testsets) |
16 | 17 | @test flattened_testsets[1].description == "Top-Level" |
@@ -135,32 +136,38 @@ end |
135 | 136 | end |
136 | 137 |
|
137 | 138 | @testset "any_problems" begin |
138 | | - @test any_problems(Pass(Symbol(), nothing, nothing, nothing)) == false |
139 | | - @test any_problems(Fail(Symbol(), nothing, nothing, nothing, LineNumberNode(1))) == true |
140 | | - @test any_problems(Broken(Symbol(1), nothing)) == false |
141 | | - @test any_problems(Error(Symbol(), nothing, nothing, nothing, LineNumberNode(1))) == true |
142 | | - |
143 | | - fail_code = """ |
144 | | - using Test |
145 | | - using TestReports |
146 | | - ts = @testset ReportingTestSet "eg" begin |
147 | | - @test false == true |
148 | | - end; |
149 | | - exit(any_problems(ts)) |
150 | | - """ |
151 | | - |
152 | | - @test_throws Exception run(`$(Base.julia_cmd()) -e $(fail_code)`) |
153 | | - |
154 | | - pass_code = """ |
155 | | - using Test |
156 | | - using TestReports |
157 | | - ts = @testset ReportingTestSet "eg" begin |
158 | | - @test true == true |
159 | | - end; |
160 | | - exit(any_problems(ts)) |
161 | | - """ |
162 | | - |
163 | | - @test run(`$(Base.julia_cmd()) -e $(pass_code)`) isa Any #this line would error if fail |
| 139 | + pass = Pass(Symbol(), nothing, nothing, nothing) |
| 140 | + fail = Fail(Symbol(), "false", nothing, nothing, LineNumberNode(1)) |
| 141 | + |
| 142 | + @testset "results" begin |
| 143 | + @test any_problems(pass) === false |
| 144 | + @test any_problems(fail) === true |
| 145 | + @test any_problems(Broken(Symbol(1), nothing)) === false |
| 146 | + @test any_problems(Error(Symbol(), nothing, nothing, nothing, LineNumberNode(1))) === true |
| 147 | + end |
| 148 | + |
| 149 | + @testset "testsets" begin |
| 150 | + ts = DefaultTestSet("") |
| 151 | + Test.record(ts, pass) |
| 152 | + @test any_problems(ts) === false |
| 153 | + Test.record(ts, fail) |
| 154 | + @test any_problems(ts) === true |
| 155 | + |
| 156 | + ts = ReportingTestSet("") |
| 157 | + Test.record(ts, pass) |
| 158 | + @test any_problems(ts) === false |
| 159 | + Test.record(ts, fail) |
| 160 | + @test any_problems(ts) === true |
| 161 | + end |
| 162 | + |
| 163 | + @testset "vector" begin |
| 164 | + ts = [ReportingTestSet("first"), ReportingTestSet("second")] |
| 165 | + Test.record(ts[1], pass) |
| 166 | + Test.record(ts[2], pass) |
| 167 | + @test any_problems(ts) === false |
| 168 | + Test.record(ts[2], fail) |
| 169 | + @test any_problems(ts) === true |
| 170 | + end |
164 | 171 | end |
165 | 172 |
|
166 | 173 | @testset "Timing" begin |
|
0 commit comments