Skip to content

Commit

Permalink
Fix regular expressions in Test tests (#57085)
Browse files Browse the repository at this point in the history
Several tests for Test.jl weren't really testing for much because `|`
characters were taken to be or operators in the regular expressions.

Co-authored-by: Chengyu Han <[email protected]>
  • Loading branch information
mhauru and inkydragon authored Jan 18, 2025
1 parent 1740287 commit fa9478b
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions stdlib/Test/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -870,12 +870,12 @@ let msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --co
end
end'`), stderr=devnull), String)
@test occursin(r"""
Test Summary: | Pass Fail Total Time
Foo Tests | 2 2 4 \s*\d*.\ds
Animals | 1 1 2 \s*\d*.\ds
Felines | 1 1 \s*\d*.\ds
Canines | 1 1 \s*\d*.\ds
Arrays | 1 1 2 \s*\d*.\ds
Test Summary: \| Pass Fail Total Time
Foo Tests \| 2 2 4 \s*\d*\.\ds
Animals \| 1 1 2 \s*\d*\.\ds
Felines \| 1 1 \s*\d*\.\ds
Canines \| 1 1 \s*\d*\.\ds
Arrays \| 1 1 2 \s*\d*\.\ds
""", msg)
end

Expand Down Expand Up @@ -1253,17 +1253,17 @@ end

@testset "verbose option" begin
expected = r"""
Test Summary: | Pass Total Time
Parent | 9 9 \s*\d*.\ds
Child 1 | 3 3 \s*\d*.\ds
Child 1.1 (long name) | 1 1 \s*\d*.\ds
Child 1.2 | 1 1 \s*\d*.\ds
Child 1.3 | 1 1 \s*\d*.\ds
Child 2 | 3 3 \s*\d*.\ds
Child 3 | 3 3 \s*\d*.\ds
Child 3.1 | 1 1 \s*\d*.\ds
Child 3.2 | 1 1 \s*\d*.\ds
Child 3.3 | 1 1 \s*\d*.\ds
Test Summary: \| Pass Total Time
Parent \| 9 9 \s*\d*\.\ds
Child 1 \| 3 3 \s*\d*\.\ds
Child 1\.1 \(long name\) \| 1 1 \s*\d*\.\ds
Child 1\.2 \| 1 1 \s*\d*\.\ds
Child 1\.3 \| 1 1 \s*\d*\.\ds
Child 2 \| 3 3 \s*\d*\.\ds
Child 3 \| 3 3 \s*\d*\.\ds
Child 3\.1 \| 1 1 \s*\d*\.\ds
Child 3\.2 \| 1 1 \s*\d*\.\ds
Child 3\.3 \| 1 1 \s*\d*\.\ds
"""

mktemp() do f, _
Expand Down Expand Up @@ -1324,9 +1324,9 @@ end
@testset "failfast option" begin
@testset "non failfast (default)" begin
expected = r"""
Test Summary: | Pass Fail Error Total Time
Foo | 1 2 1 4 \s*\d*.\ds
Bar | 1 1 2 \s*\d*.\ds
Test Summary: \| Pass Fail Error Total Time
Foo \| 1 2 1 4 \s*\d*\.\ds
Bar \| 1 1 2 \s*\d*\.\ds
"""

mktemp() do f, _
Expand All @@ -1350,8 +1350,8 @@ end
end
@testset "failfast" begin
expected = r"""
Test Summary: | Fail Total Time
Foo | 1 1 \s*\d*.\ds
Test Summary: \| Fail Total Time
Foo \| 1 1 \s*\d*\.\ds
"""

mktemp() do f, _
Expand All @@ -1375,9 +1375,9 @@ end
end
@testset "failfast passes to child testsets" begin
expected = r"""
Test Summary: | Fail Total Time
PackageName | 1 1 \s*\d*.\ds
1 | 1 1 \s*\d*.\ds
Test Summary: \| Fail Total Time
Foo \| 1 1 \s*\d*\.\ds
1 \| 1 1 \s*\d*\.\ds
"""

mktemp() do f, _
Expand All @@ -1401,8 +1401,8 @@ end
end
@testset "failfast via env var" begin
expected = r"""
Test Summary: | Fail Total Time
Foo | 1 1 \s*\d*.\ds
Test Summary: \| Fail Total Time
Foo \| 1 1 \s*\d*\.\ds
"""

mktemp() do f, _
Expand Down

0 comments on commit fa9478b

Please sign in to comment.