aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2022-01-01 16:21:34 +0000
committerLouis Pilfold <louis@lpil.uk>2022-01-01 16:21:34 +0000
commit9f723ceaa9264e70ca6238282294ba2cf2e3e739 (patch)
tree8f271790aa9a4bec72e45756d813922a93494d1f /test
parenta4dcfaba11a73fe38595eedfc7a1ce542cdc17d9 (diff)
downloadgleam_json-9f723ceaa9264e70ca6238282294ba2cf2e3e739.tar.gz
gleam_json-9f723ceaa9264e70ca6238282294ba2cf2e3e739.zip
Array functions
Diffstat (limited to 'test')
-rw-r--r--test/gleam_json_test.gleam14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/gleam_json_test.gleam b/test/gleam_json_test.gleam
index dae51b6..8fe256d 100644
--- a/test/gleam_json_test.gleam
+++ b/test/gleam_json_test.gleam
@@ -41,18 +41,24 @@ pub fn encode_object_test() {
|> should_encode("{\"foo\":5}")
}
-pub fn encode_list_test() {
- json.list([json.int(5), json.int(6)])
+pub fn encode_array_test() {
+ [5, 6, 1, 4]
+ |> json.array(of: json.int)
+ |> should_encode("[5,6,1,4]")
+}
+
+pub fn encode_preprocessed_array_test() {
+ json.preprocessed_array([json.int(5), json.int(6)])
|> should_encode("[5,6]")
}
pub fn encode_nullable_some_test() {
- json.nullable(Some(5), the: json.int)
+ json.nullable(Some(5), of: json.int)
|> should_encode("5")
}
pub fn encode_nullable_none_test() {
- json.nullable(None, the: json.int)
+ json.nullable(None, of: json.int)
|> should_encode("null")
}