aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2022-01-14 22:42:56 +0000
committerLouis Pilfold <louis@lpil.uk>2022-01-14 22:42:56 +0000
commit476195211e99133c7ef0fedf5a0d8ad3d0de5ede (patch)
tree570e50eb3d37833c8c49af6e69ee1c8fd6ac7a79 /test
parent09e64691040430c4e73f587518db2658ec96a2e7 (diff)
downloadgleam_stdlib-476195211e99133c7ef0fedf5a0d8ad3d0de5ede.tar.gz
gleam_stdlib-476195211e99133c7ef0fedf5a0d8ad3d0de5ede.zip
Fix field error
Diffstat (limited to 'test')
-rw-r--r--test/gleam/dynamic_test.gleam18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/gleam/dynamic_test.gleam b/test/gleam/dynamic_test.gleam
index cba6ff5..6fa2673 100644
--- a/test/gleam/dynamic_test.gleam
+++ b/test/gleam/dynamic_test.gleam
@@ -260,7 +260,7 @@ if javascript {
|> dynamic.from
|> dynamic.field("Nope", dynamic.int)
|> should.equal(Error([
- DecodeError(expected: "object", found: "Result", path: []),
+ DecodeError(expected: "field", found: "nothing", path: ["Nope"]),
]))
}
}
@@ -289,22 +289,30 @@ pub fn field_test() {
|> map.insert("ok", 3)
|> dynamic.from
|> dynamic.field("ok", dynamic.string)
- |> should.be_error
+ |> should.equal(Error([
+ DecodeError(expected: "String", found: "Int", path: ["ok"]),
+ ]))
map.new()
|> dynamic.from
|> dynamic.field("ok", dynamic.int)
- |> should.be_error
+ |> should.equal(Error([
+ DecodeError(expected: "field", found: "nothing", path: ["ok"]),
+ ]))
1
|> dynamic.from
|> dynamic.field("ok", dynamic.int)
- |> should.be_error
+ |> should.equal(Error([
+ DecodeError(expected: "field", found: "nothing", path: ["ok"]),
+ ]))
[]
|> dynamic.from
|> dynamic.field("ok", dynamic.int)
- |> should.be_error
+ |> should.equal(Error([
+ DecodeError(expected: "field", found: "nothing", path: ["ok"]),
+ ]))
}
pub fn element_test() {