mirror of
https://github.com/vlang/v.git
synced 2025-09-14 15:02:33 +03:00
json: move _test.v
files to vlib/json/tests/
(#22731)
This commit is contained in:
parent
9de84888b3
commit
8ebbacecd6
37 changed files with 1 additions and 1 deletions
|
@ -1,31 +0,0 @@
|
|||
import json
|
||||
|
||||
struct Number {
|
||||
min int
|
||||
max int
|
||||
}
|
||||
|
||||
pub struct Resp {
|
||||
pub:
|
||||
options []string @[omitempty]
|
||||
number &Number = unsafe { nil } @[omitempty]
|
||||
}
|
||||
|
||||
fn (r Resp) str() string {
|
||||
return json.encode(r)
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
r1 := Resp{
|
||||
options: ['first', 'second']
|
||||
}
|
||||
r2 := Resp{
|
||||
number: &Number{0, 0}
|
||||
}
|
||||
r3 := Resp{
|
||||
number: &Number{1, 2}
|
||||
}
|
||||
assert r1.str() == '{"options":["first","second"]}'
|
||||
assert r2.str() == '{"number":{"min":0,"max":0}}'
|
||||
assert r3.str() == '{"number":{"min":1,"max":2}}'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue