mirror of
https://github.com/tweag/nickel.git
synced 2024-11-10 10:46:49 +03:00
Fix equality on null
This commit is contained in:
parent
761127879f
commit
851145821c
@ -1374,6 +1374,7 @@ fn eq(env: &mut Environment, c1: Closure, c2: Closure) -> EqResult {
|
||||
}
|
||||
|
||||
match (*t1, *t2) {
|
||||
(Term::Null, Term::Null) => EqResult::Bool(true),
|
||||
(Term::Bool(b1), Term::Bool(b2)) => EqResult::Bool(b1 == b2),
|
||||
(Term::Num(n1), Term::Num(n2)) => EqResult::Bool(n1 == n2),
|
||||
(Term::Str(s1), Term::Str(s2)) => EqResult::Bool(s1 == s2),
|
||||
|
@ -999,6 +999,7 @@ Assume(#alwaysTrue, false)
|
||||
assert_peq!("\"a\" ++ \"b\" ++ \"c\"", "\"#{\"a\" ++ \"b\"}\" ++ \"c\"");
|
||||
assert_peq!("`Less", "`Less");
|
||||
assert_peq!("`small", "`small");
|
||||
assert_peq!("null", "null");
|
||||
|
||||
assert_npeq!("1 + 1", "0");
|
||||
assert_npeq!("true", "if true then false else true");
|
||||
@ -1009,6 +1010,9 @@ Assume(#alwaysTrue, false)
|
||||
assert_npeq!("`Less", "`small");
|
||||
assert_npeq!("`Less", "0");
|
||||
assert_npeq!("`Greater", "false");
|
||||
assert_npeq!("`Abc", "null");
|
||||
assert_npeq!("0", "null");
|
||||
assert_npeq!("null", "false");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user