1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: add empty_struct_compare_test.v too (#17270)

This commit is contained in:
Felipe Pena 2023-02-09 19:26:41 -03:00 committed by GitHub
parent ba9a9fdc2a
commit 3aecd01d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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{}
}