Skip to content

Commit

Permalink
Refactor JSON encoding and decoding tests for improved clarity and er…
Browse files Browse the repository at this point in the history
…ror handling
  • Loading branch information
bobzhang committed Feb 18, 2025
1 parent bd80a8b commit a7fd1b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion json/json_encode_decode_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ pub impl Show for DecodeError with output(self, logger) {
///|
fn of_json(jv : Json) -> AllThree!DecodeError {
match jv {
{ "ints": Array(ints), "floats": Array(floats), "strings": Array(strings) } => {
{
"ints": Array(ints),
"floats": Array(floats),
"strings": Array(strings),
..
} => {
let ints_result = []
let floats_result = []
let strings_result = []
Expand Down
2 changes: 1 addition & 1 deletion json/json_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ test "stringify" {
// we do come across issues like ParseError not unified with String
let newjson = @json.parse!(json.stringify())
match json {
{ "key": [_, _, _, _, { "value": Number(i) }, ..] } =>
{ "key": [_, _, _, _, { "value": Number(i), .. }, ..], .. } =>
inspect!(i, content="100")
_ => fail!("Failed to match the JSON")
}
Expand Down

0 comments on commit a7fd1b5

Please sign in to comment.