Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 25, 2024
1 parent c8583a4 commit 26f4ee6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions vlib/json/tests/json_decode_option_alias_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import json

struct Empty {}

struct SomeStruct {
random_field_a ?string
random_field_b ?string
empty_field ?Empty
}

type Alias = SomeStruct

fn test_main() {
data := json.decode(Alias, '{"empty_field":{}}')!
assert data.str() == 'Alias(SomeStruct{
random_field_a: Option(none)
random_field_b: Option(none)
empty_field: Option(none)
})'
}

0 comments on commit 26f4ee6

Please sign in to comment.