diff options
Diffstat (limited to 'test/gleam_json_test.gleam')
-rw-r--r-- | test/gleam_json_test.gleam | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/gleam_json_test.gleam b/test/gleam_json_test.gleam index fcc4a62..e2f3542 100644 --- a/test/gleam_json_test.gleam +++ b/test/gleam_json_test.gleam @@ -93,6 +93,17 @@ pub fn encode_object_test() { |> should_encode("{\"foo\":5}") } +pub fn encode_empty_object_test() { + json.object([]) + |> should_encode("{}") +} + +pub fn encode_empty_array_test() { + [] + |> json.array(of: json.int) + |> should_encode("[]") +} + pub fn encode_array_test() { [5, 6, 1, 4] |> json.array(of: json.int) @@ -104,6 +115,11 @@ pub fn encode_preprocessed_array_test() { |> should_encode("[5,6]") } +pub fn encode_empty_preprocessed_array_test() { + json.preprocessed_array([]) + |> should_encode("[]") +} + pub fn encode_nullable_some_test() { json.nullable(Some(5), of: json.int) |> should_encode("5") |