Skip to content

Commit 7c76685

Browse files
committed
fix the tests
1 parent 795be67 commit 7c76685

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/basics.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ end
5151
@testset "Basic tests" begin
5252
verbose = TestVerbosity()
5353

54-
@test_logs (:warn, "Test1") @SciMLMessage("Test1", verbose, :test1)
55-
@test_logs (:info, "Test2") @SciMLMessage("Test2", verbose, :test2)
56-
@test_logs (:error, "Test3") @test_throws "Test3" begin
54+
@test_logs (:warn, r"Test1") @SciMLMessage("Test1", verbose, :test1)
55+
@test_logs (:info, r"Test2") @SciMLMessage("Test2", verbose, :test2)
56+
@test_logs (:error, r"Test3") @test_throws "Test3" begin
5757
@SciMLMessage("Test3", verbose, :test3)
5858
end
5959
@test_logs min_level = Logging.Debug @SciMLMessage("Test4", verbose, :test4)
6060

6161
x = 30
6262
y = 30
6363

64-
@test_logs (:warn, "Test1: 60") @SciMLMessage(verbose, :test1) do
64+
@test_logs (:warn, r"Test1: 60") @SciMLMessage(verbose, :test1) do
6565
z = x + y
6666
"Test1: $z"
6767
end
@@ -74,15 +74,15 @@ end
7474
verbose_none = TestVerbosity(None())
7575

7676
# All preset should log info level messages
77-
@test_logs (:info, "All preset test") @SciMLMessage("All preset test", verbose_all, :test1)
77+
@test_logs (:info, r"All preset test") @SciMLMessage("All preset test", verbose_all, :test1)
7878

7979
# Minimal preset should only log errors and throw for error messages
80-
@test_logs (:error, "Minimal preset test") @test_throws ErrorException("Minimal preset test") begin
80+
@test_logs (:error, r"Minimal preset test") @test_throws ErrorException("Verbosity toggle: test1 \n Minimal preset test") begin
8181
@SciMLMessage("Minimal preset test", verbose_minimal, :test1)
8282
end
8383

8484
# Test that minimal preset throws for test3 (which is ErrorLevel)
85-
@test_logs (:error, "Minimal error on test3") @test_throws ErrorException("Minimal error on test3") begin
85+
@test_logs (:error, r"Minimal error on test3") @test_throws ErrorException("Verbosity toggle: test3 \n Minimal error on test3") begin
8686
@SciMLMessage("Minimal error on test3", verbose_minimal, :test3)
8787
end
8888

@@ -107,7 +107,7 @@ end
107107
verbose = TestVerbosity()
108108

109109
# Test that @SciMLMessage can be called inside another @SciMLMessage function block
110-
@test_logs (:warn, "Inner message from nested call") (:info, "Outer message with nested result") begin
110+
@test_logs (:warn, r"Inner message from nested call") (:info, r"Outer message with nested result") begin
111111
result = @SciMLMessage(verbose, :test2) do
112112
@SciMLMessage("Inner message from nested call", verbose, :test1)
113113
"Outer message with nested result"
@@ -116,7 +116,7 @@ end
116116

117117
# Test nested with both function-based inner and outer
118118
counter = 0
119-
@test_logs (:info, "Inner computation: 5") (:warn, "Outer result: 5") begin
119+
@test_logs (:info, r"Inner computation: 5") (:warn, r"Outer result: 5") begin
120120
@SciMLMessage(verbose, :test1) do
121121
inner_result = @SciMLMessage(verbose, :test2) do
122122
counter = 5
@@ -129,13 +129,13 @@ end
129129

130130
@testset "Boolean verbosity" begin
131131
# Test with true - should emit at WarnLevel (three-arg form)
132-
@test_logs (:warn, "Message with verbose=true") @SciMLMessage("Message with verbose=true", true, :ignored)
132+
@test_logs (:warn, r"Message with verbose=true") @SciMLMessage("Message with verbose=true", true, :ignored)
133133

134134
# Test with false - should not emit anything (three-arg form)
135135
@test_logs min_level = Logging.Debug @SciMLMessage("Message with verbose=false", false, :ignored)
136136

137137
# Test with function form and true (three-arg form)
138-
@test_logs (:warn, "Computed message: 42") @SciMLMessage(true, :ignored) do
138+
@test_logs (:warn, r"Computed message: 42") @SciMLMessage(true, :ignored) do
139139
x = 40 + 2
140140
"Computed message: $x"
141141
end
@@ -149,13 +149,13 @@ end
149149
@test !computation_ran # Verify function was never called when verbose=false
150150

151151
# Test two-argument form with true
152-
@test_logs (:warn, "Two-arg form with true") @SciMLMessage("Two-arg form with true", true)
152+
@test_logs (:warn, r"Two-arg form with true") @SciMLMessage("Two-arg form with true", true)
153153

154154
# Test two-argument form with false
155155
@test_logs min_level = Logging.Debug @SciMLMessage("Two-arg form with false", false)
156156

157157
# Test two-argument form with function and true
158-
@test_logs (:warn, "Two-arg computed: 100") @SciMLMessage(true) do
158+
@test_logs (:warn, r"Two-arg computed: 100") @SciMLMessage(true) do
159159
y = 50 * 2
160160
"Two-arg computed: $y"
161161
end

0 commit comments

Comments
 (0)