Add acceptance test 106 showing issue with if/is implicit casting.
This commit is contained in:
7
examples/acceptance_tests/106/aiken.lock
Normal file
7
examples/acceptance_tests/106/aiken.lock
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file was generated by Aiken
|
||||||
|
# You typically do not need to edit this file
|
||||||
|
|
||||||
|
requirements = []
|
||||||
|
packages = []
|
||||||
|
|
||||||
|
[etags]
|
||||||
9
examples/acceptance_tests/106/aiken.toml
Normal file
9
examples/acceptance_tests/106/aiken.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name = "aiken-lang/106"
|
||||||
|
version = "0.0.0"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
description = "Aiken contracts for project 'aiken-lang/106'"
|
||||||
|
|
||||||
|
[repository]
|
||||||
|
user = "aiken-lang"
|
||||||
|
project = "106"
|
||||||
|
platform = "github"
|
||||||
62
examples/acceptance_tests/106/lib/tests.ak
Normal file
62
examples/acceptance_tests/106/lib/tests.ak
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
type Foo {
|
||||||
|
foo: Int,
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bar {
|
||||||
|
Buzz
|
||||||
|
Bazz
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_1() {
|
||||||
|
let data: Data = Foo { foo: 42 }
|
||||||
|
if data is Foo {
|
||||||
|
True
|
||||||
|
} else {
|
||||||
|
False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_2() {
|
||||||
|
let data: Data = Foo { foo: 42 }
|
||||||
|
if data is Foo { .. }: Foo {
|
||||||
|
True
|
||||||
|
} else {
|
||||||
|
False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_3() {
|
||||||
|
let data: Data = Buzz
|
||||||
|
if data is Foo {
|
||||||
|
False
|
||||||
|
} else {
|
||||||
|
True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_4() {
|
||||||
|
let data: Data = Buzz
|
||||||
|
if data is Foo { .. }: Foo {
|
||||||
|
False
|
||||||
|
} else {
|
||||||
|
True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_5() {
|
||||||
|
let data: Data = Bazz
|
||||||
|
if data is Foo {
|
||||||
|
False
|
||||||
|
} else {
|
||||||
|
True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test soft_casting_6() {
|
||||||
|
let data: Data = Bazz
|
||||||
|
if data is Foo { .. }: Foo {
|
||||||
|
False
|
||||||
|
} else {
|
||||||
|
True
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user