From 96fcb658b4d5ef81515b85bafdfffcc1eaf2cdf4 Mon Sep 17 00:00:00 2001 From: andri lim Date: Tue, 15 Oct 2024 18:24:47 +0700 Subject: [PATCH] Fix import stew/results to pkg/results (#101) --- json_serialization.nimble | 3 ++- json_serialization/stew/results.nim | 2 +- tests/test_writer.nim | 21 ++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/json_serialization.nimble b/json_serialization.nimble index 9d81f9c..ef00b6b 100644 --- a/json_serialization.nimble +++ b/json_serialization.nimble @@ -18,7 +18,8 @@ skipDirs = @["tests", "fuzzer"] requires "nim >= 1.6.0", "serialization", - "stew" + "stew", + "results" let nimc = getEnv("NIMC", "nim") # Which nim compiler to use let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js) diff --git a/json_serialization/stew/results.nim b/json_serialization/stew/results.nim index 4c52978..2d1f3df 100644 --- a/json_serialization/stew/results.nim +++ b/json_serialization/stew/results.nim @@ -8,7 +8,7 @@ # those terms. import - stew/results, ../../json_serialization/[reader, writer, lexer] + pkg/results, ../../json_serialization/[reader, writer, lexer] export results diff --git a/tests/test_writer.nim b/tests/test_writer.nim index 3daad24..303b7ef 100644 --- a/tests/test_writer.nim +++ b/tests/test_writer.nim @@ -23,7 +23,7 @@ type a: Opt[int] b: Option[string] c: int - + createJsonFlavor YourJson, omitOptionalFields = false @@ -149,16 +149,16 @@ suite "Test writer": ) let u = YourJson.encode(x) - check u.string == """{"a":123,"b":"nano","c":456}""" + check u == """{"a":123,"b":"nano","c":456}""" let v = YourJson.encode(y) - check v.string == """{"a":null,"b":null,"c":999}""" + check v == """{"a":null,"b":null,"c":999}""" let xx = MyJson.encode(x) - check xx.string == """{"a":123,"b":"nano","c":456}""" + check xx == """{"a":123,"b":"nano","c":456}""" let yy = MyJson.encode(y) - check yy.string == """{"c":999}""" + check yy == """{"c":999}""" test "writeField with object with optional fields": let x = OWOF( @@ -174,14 +174,14 @@ suite "Test writer": ) let xx = MyJson.encode(x) - check xx.string == """{"a":123,"b":"nano","c":456}""" + check xx == """{"a":123,"b":"nano","c":456}""" let yy = MyJson.encode(y) - check yy.string == """{"c":999}""" + check yy == """{"c":999}""" let uu = YourJson.encode(x) - check uu.string == """{"a":123,"b":"nano","c":456}""" + check uu == """{"a":123,"b":"nano","c":456}""" let vv = YourJson.encode(y) - check vv.string == """{"a":null,"b":null,"c":999}""" + check vv == """{"a":null,"b":null,"c":999}""" test "Enum value representation primitives": when DefaultFlavor.flavorEnumRep() == EnumAsString: @@ -268,8 +268,7 @@ suite "Test writer": # configuration: Json.configureJsonSerialization(Drawer, EnumAsNumber) let u = Json.encode(Two) check u == "1" - + # configuration: MyJson.configureJsonSerialization(Drawer, EnumAsString) let v = MyJson.encode(One) check v == "\"One\"" - \ No newline at end of file