Remove old nushell/merge engine-q

This commit is contained in:
JT
2022-02-07 14:54:06 -05:00
parent 10c4c50f1f
commit d70d91e559
430 changed files with 14543 additions and 7865 deletions

View File

@ -8,11 +8,7 @@ fn shows_error_for_command_not_found() {
"ferris_is_not_here.exe"
);
<<<<<<< HEAD
assert!(actual.err.contains("Command not found"));
=======
assert!(!actual.err.is_empty());
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[cfg(feature = "which")]
@ -23,16 +19,10 @@ fn shows_error_for_command_not_found_in_pipeline() {
"ferris_is_not_here.exe | echo done"
);
<<<<<<< HEAD
assert!(actual.err.contains("Command not found"));
}
=======
assert!(!actual.err.is_empty());
}
#[ignore] // jt: we can't test this using the -c workaround currently
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[cfg(feature = "which")]
#[test]
fn automatically_change_directory() {
@ -53,11 +43,8 @@ fn automatically_change_directory() {
})
}
<<<<<<< HEAD
=======
// FIXME: jt: we don't currently support autocd in testing
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn automatically_change_directory_with_trailing_slash_and_same_name_as_command() {
use nu_test_support::playground::Playground;
@ -89,29 +76,18 @@ fn execute_binary_in_string() {
let actual = nu!(
cwd: ".",
r#"
<<<<<<< HEAD
let cmd = echo
^$"($cmd)" '$0'
=======
let cmd = "echo"
^$"($cmd)" "$0"
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#);
assert_eq!(actual.out, "$0");
}
<<<<<<< HEAD
#[test]
fn redirects_custom_command_external() {
let actual = nu!(cwd: ".", r#"def foo [] { nu --testbin cococo foo bar }; foo | str length "#);
=======
//FIXME: jt - this is blocked on https://github.com/nushell/engine-q/issues/875
#[ignore]
#[test]
fn redirects_custom_command_external() {
let actual = nu!(cwd: ".", r#"def foo [] { nu --testbin cococo foo bar }; foo | str length"#);
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
assert_eq!(actual.out, "8");
}
@ -136,11 +112,7 @@ mod it_evaluation {
| sort-by name
| get name
| each { nu --testbin cococo $it | lines }
<<<<<<< HEAD
| nth 1
=======
| get 1
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
));
@ -165,11 +137,7 @@ mod it_evaluation {
open nu_candies.txt
| lines
| each { nu --testbin chop $it | lines}
<<<<<<< HEAD
| nth 1
=======
| get 1
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
));
@ -202,11 +170,7 @@ mod it_evaluation {
cwd: dirs.test(), pipeline(
r#"
open sample.toml
<<<<<<< HEAD
| each { nu --testbin cococo $it.nu_party_venue }
=======
| nu --testbin cococo $in.nu_party_venue
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
));
@ -224,41 +188,25 @@ mod stdin_evaluation {
let actual = nu!(
cwd: ".",
pipeline(r#"
<<<<<<< HEAD
nu --testbin nonu "where's the nuline?"
| length
=======
nu --testbin nonu "wheres the nuline?" | length
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
));
assert_eq!(actual.err, "");
}
<<<<<<< HEAD
=======
// FIXME: JT: `lines` doesn't currently support this kind of streaming
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn does_not_block_indefinitely() {
let stdout = nu!(
cwd: ".",
pipeline(r#"
<<<<<<< HEAD
nu --testbin iecho yes
| nu --testbin chop
| nu --testbin chop
| lines
| first 1
=======
( nu --testbin iecho yes
| nu --testbin chop
| nu --testbin chop
| lines
| first 1 )
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
))
.out;
@ -280,11 +228,8 @@ mod external_words {
assert_eq!(actual.out, "joturner@foo.bar.baz");
}
<<<<<<< HEAD
=======
//FIXME: jt: limitation in testing - can't use single ticks currently
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn no_escaping_for_single_quoted_strings() {
let actual = nu!(cwd: ".", r#"
@ -297,12 +242,8 @@ mod external_words {
#[rstest::rstest]
#[case("sample.toml", r#""sample.toml""#)]
#[case("a sample file.toml", r#""a sample file.toml""#)]
<<<<<<< HEAD
#[case("quote'mark.toml", r#""quote'mark.toml""#)]
=======
//FIXME: jt: we don't currently support single ticks in tests
//#[case("quote'mark.toml", r#""quote'mark.toml""#)]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[cfg_attr(
not(target_os = "windows"),
case(r#"quote"mark.toml"#, r#"$"quote(char double_quote)mark.toml""#)
@ -456,28 +397,16 @@ mod external_command_arguments {
|dirs, sandbox| {
sandbox.mkdir("cd");
<<<<<<< HEAD
sandbox.with_files(vec![EmptyFile("cd/jonathan_likes_cake.txt")]);
=======
sandbox.with_files(vec![EmptyFile("cd/jt_likes_cake.txt")]);
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
<<<<<<< HEAD
^ls $"(pwd)/cd"
"#
));
assert_eq!(actual.out, "jonathan_likes_cake.txt");
=======
nu --testbin cococo $"(pwd)/cd"
"#
));
assert!(actual.out.contains("cd"));
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
},
)
}
@ -508,13 +437,8 @@ mod external_command_arguments {
#[test]
fn subcommands_are_sanitized_before_passing_to_subshell() {
let actual = nu!(
<<<<<<< HEAD
cwd: ",",
"^echo \"$(ls)\""
=======
cwd: ".",
"nu --testbin cococo \"$(ls)\""
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
);
assert_eq!(actual.out, "$(ls)");
@ -524,13 +448,8 @@ mod external_command_arguments {
#[test]
fn shell_arguments_are_sanitized_even_if_coming_from_other_commands() {
let actual = nu!(
<<<<<<< HEAD
cwd: ",",
"^echo (echo \"a;&$(hello)\")"
=======
cwd: ".",
"nu --testbin cococo (echo \"a;&$(hello)\")"
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
);
assert_eq!(actual.out, "a;&$(hello)");

View File

@ -1,8 +1,3 @@
<<<<<<< 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;
@ -28,11 +23,7 @@ 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
"#
));
@ -57,11 +48,7 @@ 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
"#
@ -73,65 +60,6 @@ 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(
"nu_times.csv",
r#"
name,rusty_luck,origin
Jason,1,Canada
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
mkdir temp;
cd temp;
let x = (open ../nu_times.csv).name;
$x | tags | get anchor | autoview;
cd ..;
rmdir temp
"#
));
// chop will remove the last escaped double quote from \"Estados Unidos\"
assert!(actual.err.contains("isn't a column"));
})
}
#[test]
fn tags_persist_through_vars() {
Playground::setup("dot_dot_dir", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"nu_times.csv",
r#"
name,rusty_luck,origin
Jason,1,Canada
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
mkdir temp;
cd temp;
let x = (open ../nu_times.csv);
$x | tags | get anchor.file | autoview;
cd ..;
rmdir temp
"#
));
// chop will remove the last escaped double quote from \"Estados Unidos\"
assert!(actual.out.contains("nu_times.csv"));
})
}
#[test]
=======
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
fn subexpression_properly_redirects() {
let actual = nu!(
cwd: ".",
@ -175,11 +103,7 @@ fn subexpression_handles_dot() {
echo (open nu_times.csv)
| get name
| each { nu --testbin chop $it | lines }
<<<<<<< HEAD
| nth 3
=======
| get 3
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
));
@ -223,11 +147,8 @@ 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!(
@ -254,33 +175,6 @@ fn string_interpolation_with_unicode() {
}
#[test]
<<<<<<< HEAD
fn bignum_large_integer() {
let actual = nu!(
cwd: ".",
r#"
echo 91231720741731287123917
"#
);
assert_eq!(actual.out, "91231720741731287123917");
}
#[test]
fn bignum_large_decimal() {
let actual = nu!(
cwd: ".",
r#"
echo 91231720741731287123917.1
"#
);
assert_eq!(actual.out, "91231720741731287123917.1");
}
#[test]
=======
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
fn run_custom_command() {
let actual = nu!(
cwd: ".",
@ -297,11 +191,7 @@ 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
"#
);
@ -313,11 +203,7 @@ 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
"#
);
@ -357,11 +243,7 @@ fn run_broken_inner_custom_command() {
"#
);
<<<<<<< HEAD
assert!(actual.err.contains("not found"));
=======
assert!(!actual.err.is_empty());
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -369,11 +251,7 @@ 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
"#
);
@ -385,11 +263,7 @@ 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
"#
);
@ -401,11 +275,7 @@ 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
"#
);
@ -425,11 +295,8 @@ 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!(
@ -439,21 +306,13 @@ 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#""#);
}
@ -462,11 +321,7 @@ 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
"#
);
@ -496,11 +351,7 @@ fn let_doesnt_leak() {
"#
);
<<<<<<< HEAD
assert!(actual.err.contains("unknown variable"));
=======
assert!(actual.err.contains("variable not found"));
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -509,11 +360,7 @@ fn let_env_variable() {
cwd: ".",
r#"
let-env TESTENVVAR = "hello world"
<<<<<<< HEAD
echo $nu.env.TESTENVVAR
=======
echo $env.TESTENVVAR
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
);
@ -526,25 +373,14 @@ 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]
@ -553,20 +389,6 @@ 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
echo $nu.env.TESTENVVAR
}
echo $nu.env.TESTENVVAR
"#
);
assert_eq!(actual.out, "hello worldhello world");
assert!(actual.err.contains("error"));
assert!(actual.err.contains("Unknown column"));
=======
echo $env.TESTENVVAR
do {
hide TESTENVVAR
@ -578,7 +400,6 @@ fn let_env_hides_variable_in_parent_scope() {
assert_eq!(actual.out, "hello world");
assert!(actual.err.contains("did you mean"));
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -587,13 +408,8 @@ 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"));
@ -604,20 +420,11 @@ 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]
@ -626,16 +433,6 @@ fn unlet_variable_in_parent_scope() {
cwd: ".",
r#"
let-env DEBUG = "1"
<<<<<<< HEAD
echo $nu.env.DEBUG
do {
let-env DEBUG = "2"
echo $nu.env.DEBUG
unlet-env DEBUG
echo $nu.env.DEBUG
}
echo $nu.env.DEBUG
=======
echo $env.DEBUG
do {
let-env DEBUG = "2"
@ -644,7 +441,6 @@ fn unlet_variable_in_parent_scope() {
echo $env.DEBUG
}
echo $env.DEBUG
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
"#
);
@ -656,11 +452,7 @@ 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
"#
);
@ -672,11 +464,7 @@ 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");
@ -687,13 +475,8 @@ 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
"#
);
@ -705,13 +488,8 @@ 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
"#
);
@ -719,31 +497,11 @@ fn load_env_variable_arg() {
}
#[test]
<<<<<<< HEAD
fn load_env_variable_arg_and_stream() {
let actual = nu!(
cwd: ".",
r#"
echo [[name, value]; [TESTVARSTREAM, "true"]] | load-env [[name, value]; [TESTVARARG, "false"]]
echo $nu.env | format "{TESTVARSTREAM} {TESTVARARG}"
"#
);
assert_eq!(actual.out, "true false");
}
#[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
"#
);
@ -755,36 +513,23 @@ 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");
@ -792,32 +537,20 @@ 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");
@ -830,11 +563,7 @@ 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");
@ -848,11 +577,7 @@ 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]
@ -860,11 +585,7 @@ 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]");
@ -922,11 +643,7 @@ 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]
@ -960,17 +677,11 @@ 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!(
@ -1024,19 +735,11 @@ 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]
@ -1152,11 +855,7 @@ 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
"#
);
@ -1168,11 +867,7 @@ 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
"#
);
@ -1244,19 +939,11 @@ 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
}
@ -1270,11 +957,7 @@ fn filesize_math2() {
"#
);
<<<<<<< HEAD
assert!(actual.err.contains("Coercion"));
=======
assert!(actual.err.contains("doesn't support"));
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -1282,38 +965,22 @@ 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]
@ -1321,19 +988,11 @@ 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]
@ -1341,19 +1000,11 @@ 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]
@ -1361,19 +1012,11 @@ 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]
@ -1409,11 +1052,7 @@ fn duration_overflow() {
"#)
);
<<<<<<< HEAD
assert!(actual.err.contains("Duration overflow"));
=======
assert!(actual.err.contains("duration too large"));
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -1426,11 +1065,7 @@ 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]
@ -1524,23 +1159,8 @@ fn nothing_string_1() {
assert_eq!(actual.out, "false");
}
<<<<<<< HEAD
#[test]
fn nothing_string_2() {
let actual = nu!(
cwd: ".", pipeline(
r#"
"" == $nothing
"#)
);
assert_eq!(actual.out, "true");
}
=======
// FIXME: no current way to hide aliases
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn unalias_shadowing() {
let actual = nu!(
@ -1558,11 +1178,8 @@ 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!(
@ -1579,11 +1196,8 @@ 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(
@ -1618,41 +1232,25 @@ 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
}
}
@ -1718,20 +1316,12 @@ 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"
);
@ -1741,11 +1331,7 @@ 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"
);
@ -1755,20 +1341,12 @@ 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"]
);

View File

@ -0,0 +1,2 @@
mod external;
mod internal;