fix argument type (#5695)

* fix argument type

* while run external, convert list argument to str

* fix argument converting logic

* using parse_list_expression instead of parse_full_cell_path

* make parsing logic more explicit

* revert changes

* add tests
This commit is contained in:
WindSoilder
2022-06-06 18:19:06 +08:00
committed by GitHub
parent 17a5aa3052
commit 75b2d26187
3 changed files with 46 additions and 14 deletions

View File

@ -306,6 +306,30 @@ mod nu_commands {
assert_eq!(actual.out, "");
}
#[test]
fn command_list_arg_test() {
let actual = nu!(cwd: ".", r#"
nu ['-c' 'version']
"#);
assert!(actual.out.contains("version"));
assert!(actual.out.contains("rust_version"));
assert!(actual.out.contains("rust_channel"));
assert!(actual.out.contains("pkg_version"));
}
#[test]
fn command_cell_path_arg_test() {
let actual = nu!(cwd: ".", r#"
nu ([ '-c' 'version' ])
"#);
assert!(actual.out.contains("version"));
assert!(actual.out.contains("rust_version"));
assert!(actual.out.contains("rust_channel"));
assert!(actual.out.contains("pkg_version"));
}
}
mod nu_script {