diff options
author | Giacomo Cavalieri <giacomo.cavalieri@icloud.com> | 2023-04-21 15:04:50 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-04-29 14:33:18 +0100 |
commit | 54b22b142d17f0fd893ec2465e53b92109aadb48 (patch) | |
tree | c7a6bba9e1c1f35e0285570cda7e4468eb9283b0 /test | |
parent | 8924398359342ad33e99d707a3c8a7fb44d99da0 (diff) | |
download | gleam_stdlib-54b22b142d17f0fd893ec2465e53b92109aadb48.tar.gz gleam_stdlib-54b22b142d17f0fd893ec2465e53b92109aadb48.zip |
Fix `dynamic.field` behaviour
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/dynamic_test.gleam | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam index a220e6e..3937ac8 100644 --- a/test/gleam/dynamic_test.gleam +++ b/test/gleam/dynamic_test.gleam @@ -300,7 +300,7 @@ if javascript { |> dynamic.from |> dynamic.field("Nope", dynamic.int) |> should.equal(Error([ - DecodeError(expected: "field", found: "nothing", path: ["Nope"]), + DecodeError(expected: "Map", found: "Result", path: []), ])) } } @@ -343,15 +343,19 @@ pub fn field_test() { 1 |> dynamic.from |> dynamic.field("ok", dynamic.int) - |> should.equal(Error([ - DecodeError(expected: "field", found: "nothing", path: ["ok"]), - ])) + |> should.equal(Error([DecodeError(expected: "Map", found: "Int", path: [])])) [] |> dynamic.from |> dynamic.field("ok", dynamic.int) + |> should.equal(Error([DecodeError(expected: "Map", found: "List", path: [])])) + + map.new() + |> map.insert("ok", 1) + |> dynamic.from + |> dynamic.field("ok", dynamic.field("not_a_field", dynamic.int)) |> should.equal(Error([ - DecodeError(expected: "field", found: "nothing", path: ["ok"]), + DecodeError(expected: "Map", found: "Int", path: ["ok"]), ])) } |