mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 04:17:46 +02:00
Support pattern matching null
literals (#10829)
# Description Support pattern matching against the `null` literal. Fixes #10799 ### Before ```nushell > match null { null => "success", _ => "failure" } failure ``` ### After ```nushell > match null { null => "success", _ => "failure" } success ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> Users can pattern match against a `null` literal.
This commit is contained in:
@ -132,6 +132,12 @@ fn match_constant_7() {
|
||||
assert_eq!(actual.out, "success");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_null() {
|
||||
let actual = nu!(r#"match null { null => { print "success"}, _ => { print "failure" }}"#);
|
||||
assert_eq!(actual.out, "success");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match_or_pattern() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user