feat: new builtins constr_index and constr_fields for alternative fast ways to take apart Data
This commit is contained in:
2
examples/acceptance_tests/116/aiken.toml
Normal file
2
examples/acceptance_tests/116/aiken.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
name = "aiken-lang/acceptance_test_116"
|
||||
version = "0.0.0"
|
||||
12
examples/acceptance_tests/116/lib/tests.ak
Normal file
12
examples/acceptance_tests/116/lib/tests.ak
Normal file
@@ -0,0 +1,12 @@
|
||||
use aiken/builtin.{constr_index}
|
||||
|
||||
test baz() {
|
||||
let x = Some("bar")
|
||||
|
||||
expect [bar] = x |> builtin.constr_fields
|
||||
|
||||
and {
|
||||
constr_index(x) == 0,
|
||||
builtin.un_b_data(bar) == "bar",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user