diff options
author | Peter <peterhsaxton@gmail.com> | 2020-07-30 09:21:34 +0100 |
---|---|---|
committer | Peter <peterhsaxton@gmail.com> | 2020-07-30 09:21:34 +0100 |
commit | ec9652394fc2c394b1dac2dd0d82a1b1457cea7c (patch) | |
tree | fba2f64a67a9ce770787dea648b61dde44c03cf8 /test | |
parent | ff8b71ddca3b4fb98b2c4f0524d34baad1df02ef (diff) | |
download | gleam_json-ec9652394fc2c394b1dac2dd0d82a1b1457cea7c.tar.gz gleam_json-ec9652394fc2c394b1dac2dd0d82a1b1457cea7c.zip |
tested decode function
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/json_test.gleam | 14 | ||||
-rw-r--r-- | test/gleam_json_test.gleam | 7 |
2 files changed, 14 insertions, 7 deletions
diff --git a/test/gleam/json_test.gleam b/test/gleam/json_test.gleam new file mode 100644 index 0000000..84f0352 --- /dev/null +++ b/test/gleam/json_test.gleam @@ -0,0 +1,14 @@ +import gleam/dynamic +import gleam/result +import gleam/json.{Json} +import gleam/should + +pub fn decode_test() { + json.decode("5") + |> result.map(dynamic.from) + |> should.equal(Ok(dynamic.from(5))) + + json.decode(".") + |> result.nil_error() + |> should.equal(Error(Nil)) +} diff --git a/test/gleam_json_test.gleam b/test/gleam_json_test.gleam deleted file mode 100644 index d3b7633..0000000 --- a/test/gleam_json_test.gleam +++ /dev/null @@ -1,7 +0,0 @@ -import gleam_json -import gleam/should - -pub fn hello_world_test() { - gleam_json.hello_world() - |> should.equal("Hello, from gleam_json!") -} |