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:
parent
ba9a9fdc2a
commit
3aecd01d05
39
vlib/v/tests/empty_struct_compare_test.v
Normal file
39
vlib/v/tests/empty_struct_compare_test.v
Normal 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{}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user