From 3aecd01d05b4c0c1a6990409be2f7dbaab04682b Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 9 Feb 2023 19:26:41 -0300 Subject: [PATCH] tests: add empty_struct_compare_test.v too (#17270) --- vlib/v/tests/empty_struct_compare_test.v | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 vlib/v/tests/empty_struct_compare_test.v diff --git a/vlib/v/tests/empty_struct_compare_test.v b/vlib/v/tests/empty_struct_compare_test.v new file mode 100644 index 0000000000..e75ece99b8 --- /dev/null +++ b/vlib/v/tests/empty_struct_compare_test.v @@ -0,0 +1,39 @@ +type MyInt = int +type MyOptInt = ?int +type MyOptStr = ?string +type MySumType = f64 | int | string + +struct Foo { + i int + i_opt ?int + arr []int + arr2 []int = [1, 2] + dec f64 + dec_opt ?f64 + dec_arr []f64 + i_arr []int + str_arr []string + opt_int ?int + opt_int2 ?int = 3 + myalias MyInt + myoptlias ?MyInt + myoptlias2 ?MyInt = MyInt(1) + myoptint MyOptInt + mysumtype MySumType + mysumtypeopt ?MySumType + str string + str2 string = 'b' + str_opt ?string + str_opt2 ?string = 'a' + str3 MyOptStr +} + +struct Bar { +pub: + foo ?Foo = none +} + +fn test_main() { + m := Bar{} + assert m == Bar{} +}