mirror of
https://github.com/nushell/nushell.git
synced 2024-12-22 23:23:12 +01:00
Finish fixing failing tests.
This commit is contained in:
parent
4cdaed1ad4
commit
84628f298d
@ -58,7 +58,7 @@ pub fn autoview(
|
||||
}
|
||||
}
|
||||
};
|
||||
} else if is_single_text_value(&input) {
|
||||
} else if is_single_origined_text_value(&input) {
|
||||
let text = context.get_command("textview");
|
||||
if let Some(text) = text {
|
||||
let result = text.run(raw.with_input(input), &context.commands);
|
||||
@ -73,6 +73,15 @@ pub fn autoview(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if is_single_text_value(&input) {
|
||||
for i in input {
|
||||
match i.item {
|
||||
Value::Primitive(Primitive::String(s)) => {
|
||||
println!("{}", s);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let table = context.expect_command("table");
|
||||
let result = table.run(raw.with_input(input), &context.commands);
|
||||
@ -96,3 +105,20 @@ fn is_single_text_value(input: &Vec<Tagged<Value>>) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn is_single_origined_text_value(input: &Vec<Tagged<Value>>) -> bool {
|
||||
if input.len() != 1 {
|
||||
return false;
|
||||
}
|
||||
if let Tagged {
|
||||
item: Value::Primitive(Primitive::String(_)),
|
||||
tag: Tag {
|
||||
origin: Some(_), ..
|
||||
},
|
||||
} = input[0]
|
||||
{
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ fn converts_structured_table_to_csv_text() {
|
||||
| to-csv
|
||||
| lines
|
||||
| nth 1
|
||||
| echo "$it"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -63,7 +63,7 @@ fn converts_structured_table_to_csv_text_skipping_headers_after_conversion() {
|
||||
| split-column "," a b c d origin
|
||||
| last 1
|
||||
| to-csv --headerless
|
||||
| echo "$it"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -261,7 +261,7 @@ fn converts_structured_table_to_tsv_text() {
|
||||
| to-tsv
|
||||
| lines
|
||||
| nth 1
|
||||
| echo "$it"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -289,7 +289,7 @@ fn converts_structured_table_to_tsv_text_skipping_headers_after_conversion() {
|
||||
| split-column "\t" a b c d origin
|
||||
| last 1
|
||||
| to-tsv --headerless
|
||||
| echo "$it"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -12,9 +12,13 @@ fn pipeline_helper() {
|
||||
| str --to-int
|
||||
| sum
|
||||
| echo "$it"
|
||||
"#);
|
||||
"#,
|
||||
);
|
||||
|
||||
assert_eq!(actual, r#"open los_tres_amigos.txt | from-csv | get rusty_luck | str --to-int | sum | echo "$it""#);
|
||||
assert_eq!(
|
||||
actual,
|
||||
r#"open los_tres_amigos.txt | from-csv | get rusty_luck | str --to-int | sum | echo "$it""#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user