Merge baeed429c6
into 4e83ccdf86
This commit is contained in:
commit
cf7eb49b48
|
@ -137,6 +137,12 @@ fn alias_match() {
|
||||||
assert_eq!(actual.out, "yes!");
|
assert_eq!(actual.out, "yes!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn alias_parenthesis_enclosed() {
|
||||||
|
let actual = nu!(r#" alias spam = (match 3 { 1..10 => 'yes!' }); spam "#);
|
||||||
|
assert_eq!(actual.out, "yes!");
|
||||||
|
}
|
||||||
|
|
||||||
// Issue https://github.com/nushell/nushell/issues/8103
|
// Issue https://github.com/nushell/nushell/issues/8103
|
||||||
#[test]
|
#[test]
|
||||||
fn alias_multiword_name() {
|
fn alias_multiword_name() {
|
||||||
|
|
|
@ -976,9 +976,11 @@ pub fn parse_alias(
|
||||||
|
|
||||||
let replacement_spans = &spans[(split_id + 2)..];
|
let replacement_spans = &spans[(split_id + 2)..];
|
||||||
let first_bytes = working_set.get_span_contents(replacement_spans[0]);
|
let first_bytes = working_set.get_span_contents(replacement_spans[0]);
|
||||||
|
let b = first_bytes[0];
|
||||||
|
|
||||||
if first_bytes != b"if"
|
if first_bytes != b"if"
|
||||||
&& first_bytes != b"match"
|
&& first_bytes != b"match"
|
||||||
|
&& b != b'('
|
||||||
&& is_math_expression_like(working_set, replacement_spans[0])
|
&& is_math_expression_like(working_set, replacement_spans[0])
|
||||||
{
|
{
|
||||||
// TODO: Maybe we need to implement a Display trait for Expression?
|
// TODO: Maybe we need to implement a Display trait for Expression?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user