add eq tests for non-equal tags

This commit is contained in:
Folkert 2021-06-29 22:35:12 +02:00
parent 6223892c6b
commit eb478cdaac

View file

@ -442,4 +442,67 @@ mod gen_compare {
assert_evals_to!("[[1]] != [[1]]", false, bool); assert_evals_to!("[[1]] != [[1]]", false, bool);
assert_evals_to!("[[2]] != [[1]]", true, bool); assert_evals_to!("[[2]] != [[1]]", true, bool);
} }
#[test]
fn compare_union_same_content() {
assert_evals_to!(
indoc!(
r#"
Foo : [ A I64, B I64 ]
a : Foo
a = A 42
b : Foo
b = B 42
a == b
"#
),
false,
bool
);
}
#[test]
fn compare_recursive_union_same_content() {
assert_evals_to!(
indoc!(
r#"
Expr : [ Add Expr Expr, Mul Expr Expr, Val1 I64, Val2 I64 ]
v1 : Expr
v1 = Val1 42
v2 : Expr
v2 = Val2 42
v1 == v2
"#
),
false,
bool
);
}
#[test]
fn compare_nullable_recursive_union_same_content() {
assert_evals_to!(
indoc!(
r#"
Expr : [ Add Expr Expr, Mul Expr Expr, Val1 I64, Val2 I64, Empty ]
v1 : Expr
v1 = Val1 42
v2 : Expr
v2 = Val2 42
v1 == v2
"#
),
false,
bool
);
}
} }