json: move _test.v files to vlib/json/tests/ (#22731)

This commit is contained in:
Hitalo Souza 2024-11-12 14:33:01 -04:00 committed by GitHub
parent 9de84888b3
commit 8ebbacecd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1 additions and 1 deletions

View file

@ -1,24 +0,0 @@
import json
struct Result[T] {
ok bool
result T
}
struct User {
id int
username string
}
fn func[T]() !T {
text := '{"ok": true, "result":{"id":37467243, "username": "ciao"}}'
a := json.decode(Result[T], text)!
return a.result
}
fn test_decode_with_generic_struct() {
ret := func[User]()!
println(ret)
assert ret.id == 37467243
assert ret.username == 'ciao'
}