From 26f4ee617fdd22df4e93be0bab8ae9b20dea2a89 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 25 Dec 2024 08:33:06 -0300 Subject: [PATCH] test --- .../tests/json_decode_option_alias_test.v | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 vlib/json/tests/json_decode_option_alias_test.v 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) +})' +}