From 81d99213db1e28229938cfd06371d6be58aed56a Mon Sep 17 00:00:00 2001 From: James Dunkerley Date: Tue, 26 Sep 2023 13:07:14 +0100 Subject: [PATCH] Fix failing tests. --- distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso | 2 +- test/Tests/src/Data/Json_Spec.enso | 2 +- test/Tests/src/Data/Time/Time_Zone_Spec.enso | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso index dec305d4df353..830c43a7d416c 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso @@ -61,7 +61,7 @@ from project.System.File_Format import Auto_Detect, File_Format read : Text | File -> File_Format -> Problem_Behavior -> Any ! File_Error read path format=Auto_Detect (on_problems=Problem_Behavior.Report_Warning) = case path of _ : Text -> if (path.starts_with "http://") || (path.starts_with "https://") then fetch path else - read (File.new path) + read (File.new path) format on_problems _ -> File.new path . read format on_problems ## ALIAS load text, open text diff --git a/test/Tests/src/Data/Json_Spec.enso b/test/Tests/src/Data/Json_Spec.enso index e8814f8b9e27f..bb304edf12e4d 100644 --- a/test/Tests/src/Data/Json_Spec.enso +++ b/test/Tests/src/Data/Json_Spec.enso @@ -66,7 +66,7 @@ spec = deep_err.should_fail_parsing_with "closing quote ] expected at position 34" "123 4".should_fail_parsing_with "JSON cannot be fully parsed at position 4" - Test.specify "should be able to deserialize Dates" <| + Test.specify "should be able to deserialize Date" <| '{"type": "Date", "constructor": "new", "year": 2018, "month": 7, "day": 3}'.should_parse_as (Date.new 2018 7 3) '{"type": "Date", "year": 2025, "month": 5, "day": 12}'.should_parse_as (Date.new 2025 5 12) '{"type": "Date", "month": 5, "day": 12}' . should_parse_as (JS_Object.from_pairs [["type", "Date"], ["month", 5], ["day", 12]]) diff --git a/test/Tests/src/Data/Time/Time_Zone_Spec.enso b/test/Tests/src/Data/Time/Time_Zone_Spec.enso index 46db0e86a1794..54424ab9ee16d 100644 --- a/test/Tests/src/Data/Time/Time_Zone_Spec.enso +++ b/test/Tests/src/Data/Time/Time_Zone_Spec.enso @@ -32,9 +32,9 @@ spec = Test.specify "should convert to Json" <| zone = Time_Zone.new 1 2 3 zone.to_json.should_equal <| - JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "new"], ["id", "+01:02:03"]] . to_text + JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "parse"], ["id", "+01:02:03"]] . to_text Time_Zone.utc.to_json.should_equal <| - JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "new"], ["id", "UTC"]] . to_text + JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "parse"], ["id", "UTC"]] . to_text Test.specify "should throw error when parsing invalid zone id" <| case Time_Zone.parse "foo" . catch of Time_Error.Error msg _ -> @@ -66,9 +66,9 @@ spec = Test.specify "should convert to Json" <| zone = ZoneOffset.ofHoursMinutesSeconds 1 2 3 zone.to_json.should_equal <| - JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "new"], ["id", "+01:02:03"]] . to_text + JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "parse"], ["id", "+01:02:03"]] . to_text (ZoneId.of "UTC").to_json.should_equal <| - JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "new"], ["id", "UTC"]] . to_text + JS_Object.from_pairs [["type", "Time_Zone"], ["constructor", "parse"], ["id", "UTC"]] . to_text Test.specify "should correctly determine the type of zone" <| zone = ZoneId.systemDefault Meta.type_of zone . should_equal_type Time_Zone