Move over last test
This commit is contained in:
parent
e6061becc0
commit
47ff6b3cb5
@ -29,35 +29,4 @@ macro_rules! test_in_fresh_env {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn prim_obj_pattern() {
|
|
||||||
let source = r#"
|
|
||||||
type Stuff = Mulch(Nat) | Jugs(Nat, String) | Mardok
|
|
||||||
let a = Stuff::Mulch(20)
|
|
||||||
let b = Stuff::Jugs(1, "haha")
|
|
||||||
let c = Stuff::Mardok
|
|
||||||
|
|
||||||
let x = if a {
|
|
||||||
is Stuff::Mulch(20) then "x",
|
|
||||||
is _ then "ERR"
|
|
||||||
}
|
|
||||||
|
|
||||||
let y = if b {
|
|
||||||
is Stuff::Mulch(n) then "ERR",
|
|
||||||
is Stuff::Jugs(2, _) then "ERR",
|
|
||||||
is Stuff::Jugs(1, s) then s,
|
|
||||||
is _ then "ERR",
|
|
||||||
}
|
|
||||||
|
|
||||||
let z = if c {
|
|
||||||
is Stuff::Jugs(_, _) then "ERR",
|
|
||||||
is Stuff::Mardok then "NIGH",
|
|
||||||
is _ then "ERR",
|
|
||||||
}
|
|
||||||
|
|
||||||
(x, y, z)
|
|
||||||
"#;
|
|
||||||
test_in_fresh_env!(source, r#"("x", "haha", "NIGH")"#);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,6 +264,38 @@ if (1, 5) {
|
|||||||
eval_assert(source, "5");
|
eval_assert(source, "5");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn prim_obj_pattern() {
|
||||||
|
let source = r#"
|
||||||
|
type Stuff = Mulch(Nat) | Jugs(Nat, String) | Mardok
|
||||||
|
let a = Stuff::Mulch(20)
|
||||||
|
let b = Stuff::Jugs(1, "haha")
|
||||||
|
let c = Stuff::Mardok
|
||||||
|
|
||||||
|
let x = if a {
|
||||||
|
is Stuff::Mulch(20) then "x",
|
||||||
|
is _ then "ERR"
|
||||||
|
}
|
||||||
|
|
||||||
|
let y = if b {
|
||||||
|
is Stuff::Mulch(n) then "ERR",
|
||||||
|
is Stuff::Jugs(2, _) then "ERR",
|
||||||
|
is Stuff::Jugs(1, s) then s,
|
||||||
|
is _ then "ERR",
|
||||||
|
}
|
||||||
|
|
||||||
|
let z = if c {
|
||||||
|
is Stuff::Jugs(_, _) then "ERR",
|
||||||
|
is Stuff::Mardok then "NIGH",
|
||||||
|
is _ then "ERR",
|
||||||
|
}
|
||||||
|
|
||||||
|
(x, y, z)
|
||||||
|
"#;
|
||||||
|
eval_assert(source, r#"("x", "haha", "NIGH")"#);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_lambda_evaluation_1() {
|
fn basic_lambda_evaluation_1() {
|
||||||
let source = r#"
|
let source = r#"
|
||||||
|
Loading…
Reference in New Issue
Block a user