mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
parent
e14bc6077b
commit
ef72f97b96
2 changed files with 40 additions and 1 deletions
25
vlib/json/json_fixed_array_test.v
Normal file
25
vlib/json/json_fixed_array_test.v
Normal file
|
@ -0,0 +1,25 @@
|
|||
import json
|
||||
|
||||
struct Base {
|
||||
options Options
|
||||
profiles Profiles
|
||||
}
|
||||
|
||||
struct Options {
|
||||
cfg [6]u8
|
||||
}
|
||||
|
||||
struct Profiles {
|
||||
cfg [4][7]u8
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
a := json.encode(Base{})
|
||||
println(a)
|
||||
assert a.contains('"cfg":[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]]')
|
||||
|
||||
b := json.decode(Base, a)!
|
||||
assert b.options.cfg.len == 6
|
||||
assert b.profiles.cfg.len == 4
|
||||
assert b.profiles.cfg[0].len == 7
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue