mirror of
https://github.com/HigherOrderCO/Kind1.git
synced 2024-08-16 11:50:40 +03:00
test: added test
This commit is contained in:
parent
be8b8aa1c7
commit
92bd9b4be2
17
crates/kind-tests/suite/kdl/ISSUE-491-2.golden
Normal file
17
crates/kind-tests/suite/kdl/ISSUE-491-2.golden
Normal file
@ -0,0 +1,17 @@
|
||||
ctr {String.nil}
|
||||
ctr {Pair.new fst snd}
|
||||
ctr {String.cons head tail}
|
||||
|
||||
fun (Test n) {
|
||||
(Test ~) = (!@x1 (!@x1.0 (Pair.match x1.0 @x2 (!@x2.0 @~ (String.match x2.0 #1 @~ @~ #2) x2)) x1) {Pair.new {String.cons #84 {String.cons #101 {String.cons #115 {String.cons #116 {String.cons #101 {String.nil}}}}}} #0})
|
||||
}
|
||||
|
||||
fun (Pair.match scrutinee new_) {
|
||||
(Pair.match {Pair.new x0 x1} x2) = (!@x2.0 (!@x1.0 (!@x0.0 (!(!x2.0 x0.0) x1.0) x0) x1) x2)
|
||||
}
|
||||
|
||||
fun (String.match scrutinee nil_ cons_) {
|
||||
(String.match {String.nil} x0 ~) = (!@x0.0 x0.0 x0)
|
||||
(String.match {String.cons x0 x1} ~ x3) = (!@x3.0 (!@x1.0 (!@x0.0 (!(!x3.0 x0.0) x1.0) x0) x1) x3)
|
||||
}
|
||||
|
32
crates/kind-tests/suite/kdl/ISSUE-491-2.kind2
Normal file
32
crates/kind-tests/suite/kdl/ISSUE-491-2.kind2
Normal file
@ -0,0 +1,32 @@
|
||||
Char : Type
|
||||
Char = U60
|
||||
|
||||
#kdl_name = T2
|
||||
#kdl_erase
|
||||
#derive[match]
|
||||
record Pair (a) (b) {
|
||||
constructor new
|
||||
fst : a
|
||||
snd : b
|
||||
}
|
||||
|
||||
#derive[match]
|
||||
type String {
|
||||
nil
|
||||
cons (head: (Char)) (tail: (String))
|
||||
}
|
||||
|
||||
#keep
|
||||
Test (n: U60) : U60
|
||||
Test n =
|
||||
let state = Pair.new "Teste" 0
|
||||
match Pair state {
|
||||
new =>
|
||||
match String state.fst {
|
||||
nil =>
|
||||
1
|
||||
cons =>
|
||||
2
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user