tests: add new type alias syntax tests

pull/4385/head
krischerven 2020-04-13 10:44:21 -04:00 committed by GitHub
parent c36984cc94
commit ac67b1ea1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 2 deletions

View File

@ -5,6 +5,21 @@ type Myf64 f64
fn test_type_alias() {
i := Myint(10)
assert i + 100 == 110
f := Myf64(10.4)
assert f + 0.5 == 10.9
f := Myf32(7.4)
assert f + f32(0.6) == f32(8.0)
g := Myf64(10.4)
assert g + 0.5 == 10.9
}
type Myint_2 = int
type Myf32_2 = f32
type Myf64_2 = f64
fn test_type_alias_v2() {
i := Myint_2(10)
assert i + 100 == 110
f := Myf32_2(7.4)
assert f + f32(0.6) == f32(8.0)
g := Myf64_2(10.4)
assert g + 0.5 == 10.9
}