Skip to content

Commit

Permalink
Add test of multidimensional array
Browse files Browse the repository at this point in the history
  • Loading branch information
esquerbatua committed Oct 7, 2024
1 parent d3c3c39 commit 0261aef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions vlib/x/json2/tests/json2_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ fn test_struct_with_string_to_map() {
assert array_of_map.str() == '[{"val":"true"},{"val":"false"}]'
}

fn test_struct_with_array_of_arrays_to_map() {
array_of_struct := [StructType[[][]bool]{
val: [[false, true], [false, true]]
}, StructType[[][]bool]{
val: [[false, true], [false, true]]
}]

mut array_of_map := []json.Any{}

for variable in array_of_struct {
array_of_map << json.map_from(variable)
}

assert array_of_map.str() == '[{"val":[false,true]},{"val":[true,false]}]'
}

fn test_struct_with_array_to_map() {
array_of_struct := [StructType[[]bool]{
val: [false, true]
Expand Down

0 comments on commit 0261aef

Please sign in to comment.