forked from extern/nushell
Updates tests for from tsv, csv, and ssv.
With the proposed changes, these tests now become invalid. If the first line is to be counted as data, then converting the headers to ints will fail. Removing the headers and instead treating the first line as data, however, reflects the new, desired mode of operation.
This commit is contained in:
parent
5bb822dcd4
commit
a3ff5f1246
@ -135,7 +135,6 @@ fn converts_from_csv_text_skipping_headers_to_structured_table() {
|
|||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||||
"los_tres_amigos.txt",
|
"los_tres_amigos.txt",
|
||||||
r#"
|
r#"
|
||||||
first_name,last_name,rusty_luck
|
|
||||||
Andrés,Robalino,1
|
Andrés,Robalino,1
|
||||||
Jonathan,Turner,1
|
Jonathan,Turner,1
|
||||||
Yehuda,Katz,1
|
Yehuda,Katz,1
|
||||||
@ -361,7 +360,6 @@ fn converts_from_tsv_text_skipping_headers_to_structured_table() {
|
|||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||||
"los_tres_amigos.txt",
|
"los_tres_amigos.txt",
|
||||||
r#"
|
r#"
|
||||||
first Name Last Name rusty_luck
|
|
||||||
Andrés Robalino 1
|
Andrés Robalino 1
|
||||||
Jonathan Turner 1
|
Jonathan Turner 1
|
||||||
Yehuda Katz 1
|
Yehuda Katz 1
|
||||||
@ -441,12 +439,11 @@ fn converts_from_ssv_text_to_structured_table_with_separator_specified() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn converts_from_ssv_text_skipping_headers_to_structured_table() {
|
fn converts_from_ssv_text_treating_first_line_as_data_with_flag() {
|
||||||
Playground::setup("filter_from_ssv_test_2", |dirs, sandbox| {
|
Playground::setup("filter_from_ssv_test_2", |dirs, sandbox| {
|
||||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||||
"oc_get_svc.txt",
|
"oc_get_svc.txt",
|
||||||
r#"
|
r#"
|
||||||
NAME LABELS SELECTOR IP PORT(S)
|
|
||||||
docker-registry docker-registry=default docker-registry=default 172.30.78.158 5000/TCP
|
docker-registry docker-registry=default docker-registry=default 172.30.78.158 5000/TCP
|
||||||
kubernetes component=apiserver,provider=kubernetes <none> 172.30.0.2 443/TCP
|
kubernetes component=apiserver,provider=kubernetes <none> 172.30.0.2 443/TCP
|
||||||
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.0.1 80/TCP
|
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.0.1 80/TCP
|
||||||
@ -458,13 +455,13 @@ fn converts_from_ssv_text_skipping_headers_to_structured_table() {
|
|||||||
r#"
|
r#"
|
||||||
open oc_get_svc.txt
|
open oc_get_svc.txt
|
||||||
| from-ssv --headerless
|
| from-ssv --headerless
|
||||||
| nth 2
|
| first
|
||||||
| get Column2
|
| get Column1
|
||||||
| echo $it
|
| echo $it
|
||||||
"#
|
"#
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(actual, "component=apiserver,provider=kubernetes");
|
assert_eq!(actual, "docker-registry");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user