mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
28 lines
421 B
V
28 lines
421 B
V
import json
|
|
|
|
struct Window {
|
|
pub mut:
|
|
width f64
|
|
height f64
|
|
}
|
|
|
|
fn make_default_window_settings() Window {
|
|
return Window{
|
|
width: 1280
|
|
height: 720
|
|
}
|
|
}
|
|
|
|
struct Settings {
|
|
pub mut:
|
|
window Window = make_default_window_settings()
|
|
}
|
|
|
|
fn test_encoding_works() {
|
|
mut settings := Settings{}
|
|
dump(settings)
|
|
encoded := json.encode(settings)
|
|
println(encoded)
|
|
assert encoded == '{"window":{"width":1280,"height":720}}'
|
|
}
|