fix: Implicit coercion of boolean false and empty value #4094 (#4120)

Signed-off-by: closetool <c299999999@qq.com>
This commit is contained in:
kiloson
2021-12-09 20:19:51 +08:00
committed by GitHub
parent ad94ed5e13
commit 9fd680ae2b
2 changed files with 20 additions and 2 deletions

View File

@ -34,3 +34,21 @@ fn compare_to_nothing() {
);
assert_eq!(actual.out, "true");
}
#[test]
fn compare_nothing_and_boolean() {
let actual = nu!(
cwd: ".",
r#"
if $true == $nothing {echo $true} {echo $false}
"#
);
assert_eq!(actual.out, "false");
let actual = nu!(
cwd: ".",
r#"
if $false == $nothing {echo $true} {echo $false}
"#
);
assert_eq!(actual.out, "false");
}