v2 / vlib / toml / tests / toml_attrs_test.v
15 lines · 12 sloc · 303 bytes · c689f801ae1215f2b0b384f1ff7d074e3c8cf7a5
Raw
1import toml
2
3struct TestStruct {
4 foo int
5 bar bool @[skip]
6 baz string = 'def' @[toml: barbaz]
7}
8
9fn test_toml_attr_encode() {
10 assert toml.encode(TestStruct{}) == 'foo = 0\nbarbaz = "def"'
11}
12
13fn test_toml_attr_decode() {
14 assert toml.decode[TestStruct]('foo = 0\nbarbaz = "def"')! == TestStruct{}
15}
16