mirror of
https://github.com/nushell/nushell
synced 2024-11-10 23:24:14 +00:00
touchup some clippy warnings in tests (#6612)
This commit is contained in:
parent
b47bd22b37
commit
43905caa46
5 changed files with 9 additions and 9 deletions
|
@ -114,7 +114,7 @@ fn external_completer_trailing_space() {
|
||||||
let block = "let external_completer = {|spans| $spans}";
|
let block = "let external_completer = {|spans| $spans}";
|
||||||
let input = "gh alias ".to_string();
|
let input = "gh alias ".to_string();
|
||||||
|
|
||||||
let suggestions = run_external_completion(&block, &input);
|
let suggestions = run_external_completion(block, &input);
|
||||||
assert_eq!(3, suggestions.len());
|
assert_eq!(3, suggestions.len());
|
||||||
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
||||||
assert_eq!("alias", suggestions.get(1).unwrap().value);
|
assert_eq!("alias", suggestions.get(1).unwrap().value);
|
||||||
|
@ -126,7 +126,7 @@ fn external_completer_no_trailing_space() {
|
||||||
let block = "let external_completer = {|spans| $spans}";
|
let block = "let external_completer = {|spans| $spans}";
|
||||||
let input = "gh alias".to_string();
|
let input = "gh alias".to_string();
|
||||||
|
|
||||||
let suggestions = run_external_completion(&block, &input);
|
let suggestions = run_external_completion(block, &input);
|
||||||
assert_eq!(2, suggestions.len());
|
assert_eq!(2, suggestions.len());
|
||||||
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
||||||
assert_eq!("alias", suggestions.get(1).unwrap().value);
|
assert_eq!("alias", suggestions.get(1).unwrap().value);
|
||||||
|
@ -137,7 +137,7 @@ fn external_completer_pass_flags() {
|
||||||
let block = "let external_completer = {|spans| $spans}";
|
let block = "let external_completer = {|spans| $spans}";
|
||||||
let input = "gh api --".to_string();
|
let input = "gh api --".to_string();
|
||||||
|
|
||||||
let suggestions = run_external_completion(&block, &input);
|
let suggestions = run_external_completion(block, &input);
|
||||||
assert_eq!(3, suggestions.len());
|
assert_eq!(3, suggestions.len());
|
||||||
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
assert_eq!("gh", suggestions.get(0).unwrap().value);
|
||||||
assert_eq!("api", suggestions.get(1).unwrap().value);
|
assert_eq!("api", suggestions.get(1).unwrap().value);
|
||||||
|
@ -637,7 +637,7 @@ fn run_external_completion(block: &str, input: &str) -> Vec<Suggestion> {
|
||||||
// Instatiate a new completer
|
// Instatiate a new completer
|
||||||
let mut completer = NuCompleter::new(std::sync::Arc::new(engine_state), stack);
|
let mut completer = NuCompleter::new(std::sync::Arc::new(engine_state), stack);
|
||||||
|
|
||||||
completer.complete(&input, input.len())
|
completer.complete(input, input.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -149,7 +149,7 @@ fn can_source_dynamic_path() {
|
||||||
Playground::setup("can_source_dynamic_path", |dirs, sandbox| {
|
Playground::setup("can_source_dynamic_path", |dirs, sandbox| {
|
||||||
let foo_file = "foo.nu";
|
let foo_file = "foo.nu";
|
||||||
|
|
||||||
sandbox.with_files(vec![FileWithContent(&foo_file, "echo foo")]);
|
sandbox.with_files(vec![FileWithContent(foo_file, "echo foo")]);
|
||||||
|
|
||||||
let cmd = format!("let file = `{}`; source-env $file", foo_file);
|
let cmd = format!("let file = `{}`; source-env $file", foo_file);
|
||||||
let actual = nu!(cwd: dirs.test(), &cmd);
|
let actual = nu!(cwd: dirs.test(), &cmd);
|
||||||
|
|
|
@ -289,7 +289,7 @@ proptest! {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn to_nuon_from_nuon_string(s: String) {
|
fn to_nuon_from_nuon_string(s: String) {
|
||||||
if s != "\\0" && s!= "" && !s.contains('\\') && !s.contains('"'){
|
if s != "\\0" && !s.is_empty() && !s.contains('\\') && !s.contains('"'){
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: "tests/fixtures/formats", pipeline(
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
format!(r#"
|
format!(r#"
|
||||||
|
|
|
@ -5,7 +5,7 @@ use nu_protocol::{Span, Value};
|
||||||
// generate a new table data with `row_cnt` rows, `col_cnt` columns.
|
// generate a new table data with `row_cnt` rows, `col_cnt` columns.
|
||||||
fn new_test_data(row_cnt: usize, col_cnt: usize) -> Value {
|
fn new_test_data(row_cnt: usize, col_cnt: usize) -> Value {
|
||||||
let columns: Vec<String> = (0..col_cnt).map(|x| format!("col_{x}")).collect();
|
let columns: Vec<String> = (0..col_cnt).map(|x| format!("col_{x}")).collect();
|
||||||
let vals: Vec<Value> = (0..col_cnt as i64).map(|i| Value::test_int(i)).collect();
|
let vals: Vec<Value> = (0..col_cnt as i64).map(Value::test_int).collect();
|
||||||
|
|
||||||
Value::List {
|
Value::List {
|
||||||
vals: (0..row_cnt)
|
vals: (0..row_cnt)
|
||||||
|
|
|
@ -4,7 +4,7 @@ use num_format::Grouping;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_system_locale_en() {
|
fn test_get_system_locale_en() {
|
||||||
let locale = with_locale_override("en_US.UTF-8", || get_system_locale());
|
let locale = with_locale_override("en_US.UTF-8", get_system_locale);
|
||||||
|
|
||||||
assert_eq!(locale.name(), "en");
|
assert_eq!(locale.name(), "en");
|
||||||
assert_eq!(locale.grouping(), Grouping::Standard)
|
assert_eq!(locale.grouping(), Grouping::Standard)
|
||||||
|
@ -12,7 +12,7 @@ fn test_get_system_locale_en() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_system_locale_de() {
|
fn test_get_system_locale_de() {
|
||||||
let locale = with_locale_override("de_DE.UTF-8", || get_system_locale());
|
let locale = with_locale_override("de_DE.UTF-8", get_system_locale);
|
||||||
|
|
||||||
assert_eq!(locale.name(), "de");
|
assert_eq!(locale.name(), "de");
|
||||||
assert_eq!(locale.grouping(), Grouping::Standard)
|
assert_eq!(locale.grouping(), Grouping::Standard)
|
||||||
|
|
Loading…
Reference in a new issue