Skip to content

Commit a7fd1b5

Browse files
committed
Refactor JSON encoding and decoding tests for improved clarity and error handling
1 parent bd80a8b commit a7fd1b5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

json/json_encode_decode_test.mbt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ pub impl Show for DecodeError with output(self, logger) {
5252
///|
5353
fn of_json(jv : Json) -> AllThree!DecodeError {
5454
match jv {
55-
{ "ints": Array(ints), "floats": Array(floats), "strings": Array(strings) } => {
55+
{
56+
"ints": Array(ints),
57+
"floats": Array(floats),
58+
"strings": Array(strings),
59+
..
60+
} => {
5661
let ints_result = []
5762
let floats_result = []
5863
let strings_result = []

json/json_test.mbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ test "stringify" {
274274
// we do come across issues like ParseError not unified with String
275275
let newjson = @json.parse!(json.stringify())
276276
match json {
277-
{ "key": [_, _, _, _, { "value": Number(i) }, ..] } =>
277+
{ "key": [_, _, _, _, { "value": Number(i), .. }, ..], .. } =>
278278
inspect!(i, content="100")
279279
_ => fail!("Failed to match the JSON")
280280
}

0 commit comments

Comments
 (0)