forked from extern/nushell
engine-q merge
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
<<<<<<< HEAD
|
||||
#[cfg(feature = "which")]
|
||||
use nu_test_support::fs::Stub::FileWithContent;
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::nu;
|
||||
use nu_test_support::pipeline;
|
||||
@ -25,7 +28,11 @@ fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
|
||||
open nu_times.csv
|
||||
| get origin
|
||||
| each { ^echo $it | nu --testbin chop | lines }
|
||||
<<<<<<< HEAD
|
||||
| nth 2
|
||||
=======
|
||||
| get 2
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
));
|
||||
|
||||
@ -50,7 +57,11 @@ fn treats_dot_dot_as_path_not_range() {
|
||||
r#"
|
||||
mkdir temp;
|
||||
cd temp;
|
||||
<<<<<<< HEAD
|
||||
echo (open ../nu_times.csv).name | autoview;
|
||||
=======
|
||||
echo (open ../nu_times.csv).name.0 | table;
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
cd ..;
|
||||
rmdir temp
|
||||
"#
|
||||
@ -62,6 +73,7 @@ fn treats_dot_dot_as_path_not_range() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn tags_dont_persist_through_column_path() {
|
||||
Playground::setup("dot_dot_dir", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
@ -118,6 +130,8 @@ fn tags_persist_through_vars() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn subexpression_properly_redirects() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
@ -161,7 +175,11 @@ fn subexpression_handles_dot() {
|
||||
echo (open nu_times.csv)
|
||||
| get name
|
||||
| each { nu --testbin chop $it | lines }
|
||||
<<<<<<< HEAD
|
||||
| nth 3
|
||||
=======
|
||||
| get 3
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
));
|
||||
|
||||
@ -205,6 +223,11 @@ fn string_interpolation_shorthand_overlap() {
|
||||
assert_eq!(actual.out, "3 + 4 = 7");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// FIXME: jt - we don't currently have a way to escape the single ticks easily
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn string_interpolation_and_paren() {
|
||||
let actual = nu!(
|
||||
@ -231,6 +254,7 @@ fn string_interpolation_with_unicode() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn bignum_large_integer() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
@ -255,6 +279,8 @@ fn bignum_large_decimal() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn run_custom_command() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
@ -271,7 +297,11 @@ fn run_custom_command_with_flag() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def foo [--bar:number] { if ($bar | empty?) { echo "empty" } { echo $bar } }; foo --bar 10
|
||||
=======
|
||||
def foo [--bar:number] { if ($bar | empty?) { echo "empty" } else { echo $bar } }; foo --bar 10
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -283,7 +313,11 @@ fn run_custom_command_with_flag_missing() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def foo [--bar:number] { if ($bar | empty?) { echo "empty" } { echo $bar } }; foo
|
||||
=======
|
||||
def foo [--bar:number] { if ($bar | empty?) { echo "empty" } else { echo $bar } }; foo
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -323,7 +357,11 @@ fn run_broken_inner_custom_command() {
|
||||
"#
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("not found"));
|
||||
=======
|
||||
assert!(!actual.err.is_empty());
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -331,7 +369,11 @@ fn run_custom_command_with_rest() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def rest-me [...rest: string] { echo $rest.1 $rest.0}; rest-me "hello" "world" | to json
|
||||
=======
|
||||
def rest-me [...rest: string] { echo $rest.1 $rest.0}; rest-me "hello" "world" | to json --raw
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -343,7 +385,11 @@ fn run_custom_command_with_rest_and_arg() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def rest-me-with-arg [name: string, ...rest: string] { echo $rest.1 $rest.0 $name}; rest-me-with-arg "hello" "world" "yay" | to json
|
||||
=======
|
||||
def rest-me-with-arg [name: string, ...rest: string] { echo $rest.1 $rest.0 $name}; rest-me-with-arg "hello" "world" "yay" | to json --raw
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -355,7 +401,11 @@ fn run_custom_command_with_rest_and_flag() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def rest-me-with-flag [--name: string, ...rest: string] { echo $rest.1 $rest.0 $name}; rest-me-with-flag "hello" "world" --name "yay" | to json
|
||||
=======
|
||||
def rest-me-with-flag [--name: string, ...rest: string] { echo $rest.1 $rest.0 $name}; rest-me-with-flag "hello" "world" --name "yay" | to json --raw
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -375,6 +425,11 @@ fn run_custom_command_with_empty_rest() {
|
||||
assert_eq!(actual.err, r#""#);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//FIXME: jt: blocked on https://github.com/nushell/engine-q/issues/912
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn run_custom_command_with_rest_other_name() {
|
||||
let actual = nu!(
|
||||
@ -384,13 +439,21 @@ fn run_custom_command_with_rest_other_name() {
|
||||
greeting:string,
|
||||
...names:string # All of the names
|
||||
] {
|
||||
<<<<<<< HEAD
|
||||
echo $"($greeting), ($names | sort-by | str collect ' ')"
|
||||
=======
|
||||
echo $"($greeting), ($names | sort-by | str collect)"
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
say-hello Salutations E D C A B
|
||||
"#
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert_eq!(actual.out, r#"Salutations, A B C D E"#);
|
||||
=======
|
||||
assert_eq!(actual.out, r#"Salutations, ABCDE"#);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
assert_eq!(actual.err, r#""#);
|
||||
}
|
||||
|
||||
@ -399,7 +462,11 @@ fn alias_a_load_env() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
def activate-helper [] { [[name, value]; [BOB, SAM]] }; alias activate = load-env (activate-helper); activate; $nu.env.BOB
|
||||
=======
|
||||
def activate-helper [] { {BOB: SAM} }; alias activate = load-env (activate-helper); activate; $env.BOB
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -429,7 +496,11 @@ fn let_doesnt_leak() {
|
||||
"#
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unknown variable"));
|
||||
=======
|
||||
assert!(actual.err.contains("variable not found"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -438,7 +509,11 @@ fn let_env_variable() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env TESTENVVAR = "hello world"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.TESTENVVAR
|
||||
=======
|
||||
echo $env.TESTENVVAR
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -451,15 +526,25 @@ fn let_env_hides_variable() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env TESTENVVAR = "hello world"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.TESTENVVAR
|
||||
let-env TESTENVVAR = $nothing
|
||||
echo $nu.env.TESTENVVAR
|
||||
=======
|
||||
echo $env.TESTENVVAR
|
||||
hide TESTENVVAR
|
||||
echo $env.TESTENVVAR
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "hello world");
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("error"));
|
||||
assert!(actual.err.contains("Unknown column"));
|
||||
=======
|
||||
assert!(actual.err.contains("did you mean"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -468,6 +553,7 @@ fn let_env_hides_variable_in_parent_scope() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env TESTENVVAR = "hello world"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.TESTENVVAR
|
||||
do {
|
||||
let-env TESTENVVAR = $nothing
|
||||
@ -480,6 +566,19 @@ fn let_env_hides_variable_in_parent_scope() {
|
||||
assert_eq!(actual.out, "hello worldhello world");
|
||||
assert!(actual.err.contains("error"));
|
||||
assert!(actual.err.contains("Unknown column"));
|
||||
=======
|
||||
echo $env.TESTENVVAR
|
||||
do {
|
||||
hide TESTENVVAR
|
||||
echo $env.TESTENVVAR
|
||||
}
|
||||
echo $env.TESTENVVAR
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "hello world");
|
||||
assert!(actual.err.contains("did you mean"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -488,8 +587,13 @@ fn unlet_env_variable() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env TEST_VAR = "hello world"
|
||||
<<<<<<< HEAD
|
||||
unlet-env TEST_VAR
|
||||
echo $nu.env.TEST_VAR
|
||||
=======
|
||||
hide TEST_VAR
|
||||
echo $env.TEST_VAR
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert!(actual.err.contains("did you mean"));
|
||||
@ -500,12 +604,20 @@ fn unlet_nonexistent_variable() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
unlet-env NONEXISTENT_VARIABLE
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("error"));
|
||||
assert!(actual.err.contains("Not an environment variable"));
|
||||
=======
|
||||
hide NONEXISTENT_VARIABLE
|
||||
"#
|
||||
);
|
||||
|
||||
assert!(actual.err.contains("did not find"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -514,6 +626,7 @@ fn unlet_variable_in_parent_scope() {
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env DEBUG = "1"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.DEBUG
|
||||
do {
|
||||
let-env DEBUG = "2"
|
||||
@ -522,6 +635,16 @@ fn unlet_variable_in_parent_scope() {
|
||||
echo $nu.env.DEBUG
|
||||
}
|
||||
echo $nu.env.DEBUG
|
||||
=======
|
||||
echo $env.DEBUG
|
||||
do {
|
||||
let-env DEBUG = "2"
|
||||
echo $env.DEBUG
|
||||
hide DEBUG
|
||||
echo $env.DEBUG
|
||||
}
|
||||
echo $env.DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -533,7 +656,11 @@ fn let_env_doesnt_leak() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
do { let-env xyz = "my message" }; echo $nu.env.xyz
|
||||
=======
|
||||
do { let-env xyz = "my message" }; echo $env.xyz
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -545,7 +672,11 @@ fn proper_shadow_let_env_aliases() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
let-env DEBUG = true; echo $nu.env.DEBUG | autoview; do { let-env DEBUG = false; echo $nu.env.DEBUG } | autoview; echo $nu.env.DEBUG
|
||||
=======
|
||||
let-env DEBUG = true; echo $env.DEBUG | table; do { let-env DEBUG = false; echo $env.DEBUG } | table; echo $env.DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "truefalsetrue");
|
||||
@ -556,8 +687,13 @@ fn load_env_variable() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
echo [[name, value]; [TESTENVVAR, "hello world"]] | load-env
|
||||
echo $nu.env.TESTENVVAR
|
||||
=======
|
||||
echo {TESTENVVAR: "hello world"} | load-env
|
||||
echo $env.TESTENVVAR
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -569,8 +705,13 @@ fn load_env_variable_arg() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
load-env [[name, value]; [TESTENVVAR, "hello world"]]
|
||||
echo $nu.env.TESTENVVAR
|
||||
=======
|
||||
load-env {TESTENVVAR: "hello world"}
|
||||
echo $env.TESTENVVAR
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -578,6 +719,7 @@ fn load_env_variable_arg() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
<<<<<<< HEAD
|
||||
fn load_env_variable_arg_and_stream() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
@ -591,11 +733,17 @@ fn load_env_variable_arg_and_stream() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
=======
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
fn load_env_doesnt_leak() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
do { echo [[name, value]; [xyz, "my message"]] | load-env }; echo $nu.env.xyz
|
||||
=======
|
||||
do { echo { name: xyz, value: "my message" } | load-env }; echo $env.xyz
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -607,21 +755,36 @@ fn proper_shadow_load_env_aliases() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
let-env DEBUG = true; echo $nu.env.DEBUG | autoview; do { echo [[name, value]; [DEBUG, false]] | load-env; echo $nu.env.DEBUG } | autoview; echo $nu.env.DEBUG
|
||||
=======
|
||||
let-env DEBUG = true; echo $env.DEBUG | table; do { echo {DEBUG: "false"} | load-env; echo $env.DEBUG } | table; echo $env.DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "truefalsetrue");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//FIXME: jt: load-env can not currently hide variables because $nothing no longer hides
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn load_env_can_hide_var_envs() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env DEBUG = "1"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.DEBUG
|
||||
load-env [[name, value]; [DEBUG $nothing]]
|
||||
echo $nu.env.DEBUG
|
||||
=======
|
||||
echo $env.DEBUG
|
||||
load-env [[name, value]; [DEBUG $nothing]]
|
||||
echo $env.DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "1");
|
||||
@ -629,18 +792,32 @@ fn load_env_can_hide_var_envs() {
|
||||
assert!(actual.err.contains("Unknown column"));
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//FIXME: jt: load-env can not currently hide variables because $nothing no longer hides
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn load_env_can_hide_var_envs_in_parent_scope() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
let-env DEBUG = "1"
|
||||
<<<<<<< HEAD
|
||||
echo $nu.env.DEBUG
|
||||
do {
|
||||
load-env [[name, value]; [DEBUG $nothing]]
|
||||
echo $nu.env.DEBUG
|
||||
}
|
||||
echo $nu.env.DEBUG
|
||||
=======
|
||||
echo $env.DEBUG
|
||||
do {
|
||||
load-env [[name, value]; [DEBUG $nothing]]
|
||||
echo $env.DEBUG
|
||||
}
|
||||
echo $env.DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "11");
|
||||
@ -653,7 +830,11 @@ fn proper_shadow_let_aliases() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
let DEBUG = false; echo $DEBUG | autoview; do { let DEBUG = true; echo $DEBUG } | autoview; echo $DEBUG
|
||||
=======
|
||||
let DEBUG = $false; echo $DEBUG | table; do { let DEBUG = $true; echo $DEBUG } | table; echo $DEBUG
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "falsetruefalse");
|
||||
@ -667,7 +848,11 @@ fn block_params_override() {
|
||||
[1, 2, 3] | each { |a| echo $it }
|
||||
"#
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unknown variable"));
|
||||
=======
|
||||
assert!(actual.err.contains("variable not found"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -675,7 +860,11 @@ fn block_params_override_correct() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
[1, 2, 3] | each { |a| echo $a } | to json
|
||||
=======
|
||||
[1, 2, 3] | each { |a| echo $a } | to json --raw
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
assert_eq!(actual.out, "[1,2,3]");
|
||||
@ -733,7 +922,11 @@ fn argument_subexpression_reports_errors() {
|
||||
"echo (ferris_is_not_here.exe)"
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("Command not found"));
|
||||
=======
|
||||
assert!(!actual.err.is_empty());
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -767,9 +960,17 @@ fn index_out_of_bounds() {
|
||||
"#
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unknown row"));
|
||||
}
|
||||
|
||||
=======
|
||||
assert!(actual.err.contains("too large"));
|
||||
}
|
||||
|
||||
//FIXME: jt - umm, do we actually want to support this?
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn dash_def() {
|
||||
let actual = nu!(
|
||||
@ -823,11 +1024,19 @@ fn index_row() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
let foo = [[name]; [joe] [bob]]; echo $foo.1 | to json
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, r#"{"name":"bob"}"#);
|
||||
=======
|
||||
let foo = [[name]; [joe] [bob]]; echo $foo.1 | to json --raw
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, r#"{"name": "bob"}"#);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -943,7 +1152,11 @@ fn range_with_left_var() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
echo [[size]; [3]] | each { echo $it.size..10 } | math sum
|
||||
=======
|
||||
({ size: 3}.size)..10 | math sum
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -955,7 +1168,11 @@ fn range_with_right_var() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
echo [[size]; [30]] | each { echo 4..$it.size } | math sum
|
||||
=======
|
||||
4..({ size: 30}.size) | math sum
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
"#
|
||||
);
|
||||
|
||||
@ -1027,11 +1244,19 @@ fn filesize_math() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
100 * 10kb
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1000.0 KB");
|
||||
=======
|
||||
100 * 10kib
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1000.0 KiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
// why 1000.0 KB instead of 1.0 MB?
|
||||
// looks like `byte.get_appropriate_unit(false)` behaves this way
|
||||
}
|
||||
@ -1045,7 +1270,11 @@ fn filesize_math2() {
|
||||
"#
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("Coercion"));
|
||||
=======
|
||||
assert!(actual.err.contains("doesn't support"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1053,22 +1282,38 @@ fn filesize_math3() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
100kb / 10
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "10.0 KB");
|
||||
=======
|
||||
100kib / 10
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "10.0 KiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
#[test]
|
||||
fn filesize_math4() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
100kb * 5
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "500.0 KB");
|
||||
=======
|
||||
100kib * 5
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "500.0 KiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1076,11 +1321,19 @@ fn filesize_math5() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
1001 * 1kb
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1.0 MB");
|
||||
=======
|
||||
1000 * 1kib
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1000.0 KiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1088,11 +1341,19 @@ fn filesize_math6() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
1001 * 1mb
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1.0 GB");
|
||||
=======
|
||||
1000 * 1mib
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1000.0 MiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1100,11 +1361,19 @@ fn filesize_math7() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
<<<<<<< HEAD
|
||||
1001 * 1gb
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1.0 TB");
|
||||
=======
|
||||
1000 * 1gib
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1000.0 GiB");
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1140,7 +1409,11 @@ fn duration_overflow() {
|
||||
"#)
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("Duration overflow"));
|
||||
=======
|
||||
assert!(actual.err.contains("duration too large"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1153,7 +1426,11 @@ fn date_and_duration_overflow() {
|
||||
);
|
||||
|
||||
// assert_eq!(actual.err, "overflow");
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("Duration and date addition overflow"));
|
||||
=======
|
||||
assert!(actual.err.contains("duration too large"));
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1247,6 +1524,7 @@ fn nothing_string_1() {
|
||||
assert_eq!(actual.out, "false");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
#[test]
|
||||
fn nothing_string_2() {
|
||||
let actual = nu!(
|
||||
@ -1259,6 +1537,10 @@ fn nothing_string_2() {
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
=======
|
||||
// FIXME: no current way to hide aliases
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn unalias_shadowing() {
|
||||
let actual = nu!(
|
||||
@ -1276,6 +1558,11 @@ fn unalias_shadowing() {
|
||||
assert_eq!(actual.out, "hello");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// FIXME: no current way to hide aliases
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn unalias_does_not_escape_scope() {
|
||||
let actual = nu!(
|
||||
@ -1292,6 +1579,11 @@ fn unalias_does_not_escape_scope() {
|
||||
assert_eq!(actual.out, "hello");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// FIXME: no current way to hide aliases
|
||||
#[ignore]
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
#[test]
|
||||
fn unalias_hides_alias() {
|
||||
let actual = nu!(cwd: ".", pipeline(
|
||||
@ -1326,25 +1618,41 @@ mod parse {
|
||||
fn errors_if_flag_passed_is_not_exact() {
|
||||
let actual = nu!(cwd: ".", "debug -ra");
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unexpected flag"),);
|
||||
|
||||
let actual = nu!(cwd: ".", "debug --rawx");
|
||||
|
||||
assert!(actual.err.contains("unexpected flag"),);
|
||||
=======
|
||||
assert!(actual.err.contains("unknown flag"),);
|
||||
|
||||
let actual = nu!(cwd: ".", "debug --rawx");
|
||||
|
||||
assert!(actual.err.contains("unknown flag"),);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_flag_is_not_supported() {
|
||||
let actual = nu!(cwd: ".", "debug --ferris");
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unexpected flag"),);
|
||||
=======
|
||||
assert!(actual.err.contains("unknown flag"),);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn errors_if_passed_an_unexpected_argument() {
|
||||
let actual = nu!(cwd: ".", "debug ferris");
|
||||
|
||||
<<<<<<< HEAD
|
||||
assert!(actual.err.contains("unexpected argument"),);
|
||||
=======
|
||||
assert!(actual.err.contains("extra positional argument"),);
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
}
|
||||
}
|
||||
|
||||
@ -1410,12 +1718,20 @@ mod variable_scoping {
|
||||
== "ZZZ"
|
||||
);
|
||||
test_variable_scope!(
|
||||
<<<<<<< HEAD
|
||||
r#" def test [input] { echo [0 1 2] | do { do { if $input == "ZZZ" { echo $input } { echo $input } } } }
|
||||
=======
|
||||
r#" def test [input] { echo [0 1 2] | do { do { if $input == "ZZZ" { echo $input } else { echo $input } } } }
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
test ZZZ "#
|
||||
== "ZZZ"
|
||||
);
|
||||
test_variable_scope!(
|
||||
<<<<<<< HEAD
|
||||
r#" def test [input] { echo [0 1 2] | do { do { if $input == "ZZZ" { echo $input } { echo $input } } } }
|
||||
=======
|
||||
r#" def test [input] { echo [0 1 2] | do { do { if $input == "ZZZ" { echo $input } else { echo $input } } } }
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
test ZZZ "#
|
||||
== "ZZZ"
|
||||
);
|
||||
@ -1425,7 +1741,11 @@ mod variable_scoping {
|
||||
== "ZZZ"
|
||||
);
|
||||
test_variable_scope!(
|
||||
<<<<<<< HEAD
|
||||
r#" def test [input] { echo [0 1 2] | do { if $input == $input { echo $input } { echo $input } } }
|
||||
=======
|
||||
r#" def test [input] { echo [0 1 2] | do { if $input == $input { echo $input } else { echo $input } } }
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
test ZZZ "#
|
||||
== "ZZZ"
|
||||
);
|
||||
@ -1435,12 +1755,20 @@ mod variable_scoping {
|
||||
== ["ZZZ", "ZZZ", "ZZZ"]
|
||||
);
|
||||
test_variable_scope_list!(
|
||||
<<<<<<< HEAD
|
||||
r#" def test [input] { echo [0 1 2] | each { if $it > 0 {echo $input} {echo $input}} }
|
||||
=======
|
||||
r#" def test [input] { echo [0 1 2] | each { if $it > 0 {echo $input} else {echo $input}} }
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
test ZZZ "#
|
||||
== ["ZZZ", "ZZZ", "ZZZ"]
|
||||
);
|
||||
test_variable_scope_list!(
|
||||
<<<<<<< HEAD
|
||||
r#" def test [input] { echo [0 1 2] | each { if $input == $input {echo $input} {echo $input}} }
|
||||
=======
|
||||
r#" def test [input] { echo [0 1 2] | each { if $input == $input {echo $input} else {echo $input}} }
|
||||
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
|
||||
test ZZZ "#
|
||||
== ["ZZZ", "ZZZ", "ZZZ"]
|
||||
);
|
||||
|
Reference in New Issue
Block a user