diff --git a/vlib/json/tests/json_decode_option_alias_test.v b/vlib/json/tests/json_decode_option_alias_test.v new file mode 100644 index 00000000000000..f4c7c51b965e79 --- /dev/null +++ b/vlib/json/tests/json_decode_option_alias_test.v @@ -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) +})' +}