Spec_Result is not private

This commit is contained in:
Pavel Marek 2024-01-29 18:49:05 +01:00
parent 8d797f1a4a
commit 5767535af2
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,3 @@
private
from Standard.Base import all
## Result of one test Spec

View File

@ -6,6 +6,7 @@ import Standard.Base.Errors.No_Such_Key.No_Such_Key
from Standard.Base.Data.Json import Invalid_JSON
from Standard.Test_New import all
import Standard.Test_New.Spec_Result.Spec_Result
@ -17,17 +18,17 @@ type Book
Text.should_fail_parsing_with self expected =
as_fail = case Json.parse self of
_ -> Test_Result.Failure "Expected a parse error, but no error reported."
_ -> Spec_Result.Failure "Expected a parse error, but no error reported."
result = as_fail.catch Any e-> case e of
Invalid_JSON.Error msg ->
if msg.contains expected then Test_Result.Success else
if msg.contains expected then Spec_Result.Success else
fail_msg = "The reported message " + msg.to_text + " did not contain " + expected.to_text + "."
Test_Result.Failure fail_msg
Spec_Result.Failure fail_msg
_ ->
fail_msg = "Expected a parser error, but " + e.to_text + " was thrown."
Test_Result.Failure fail_msg
Spec_Result.Failure fail_msg
case result of
Test_Result.Success -> Test_Result.Success
Spec_Result.Success -> Spec_Result.Success
_ -> Panic.throw result
Text.should_parse_as self expected =