From a3ff5f12460c44286d2e5e00c9712379e643a306 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Sun, 3 Nov 2019 23:12:14 +0100 Subject: [PATCH] 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. --- tests/filters_test.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/filters_test.rs b/tests/filters_test.rs index e410e99e6..9ccb4ab71 100644 --- a/tests/filters_test.rs +++ b/tests/filters_test.rs @@ -135,7 +135,6 @@ fn converts_from_csv_text_skipping_headers_to_structured_table() { sandbox.with_files(vec![FileWithContentToBeTrimmed( "los_tres_amigos.txt", r#" - first_name,last_name,rusty_luck Andrés,Robalino,1 Jonathan,Turner,1 Yehuda,Katz,1 @@ -361,7 +360,6 @@ fn converts_from_tsv_text_skipping_headers_to_structured_table() { sandbox.with_files(vec![FileWithContentToBeTrimmed( "los_tres_amigos.txt", r#" - first Name Last Name rusty_luck Andrés Robalino 1 Jonathan Turner 1 Yehuda Katz 1 @@ -441,12 +439,11 @@ fn converts_from_ssv_text_to_structured_table_with_separator_specified() { } #[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| { sandbox.with_files(vec![FileWithContentToBeTrimmed( "oc_get_svc.txt", r#" - NAME LABELS SELECTOR IP PORT(S) docker-registry docker-registry=default docker-registry=default 172.30.78.158 5000/TCP kubernetes component=apiserver,provider=kubernetes 172.30.0.2 443/TCP kubernetes-ro component=apiserver,provider=kubernetes 172.30.0.1 80/TCP @@ -458,13 +455,13 @@ fn converts_from_ssv_text_skipping_headers_to_structured_table() { r#" open oc_get_svc.txt | from-ssv --headerless - | nth 2 - | get Column2 + | first + | get Column1 | echo $it "# )); - assert_eq!(actual, "component=apiserver,provider=kubernetes"); + assert_eq!(actual, "docker-registry"); }) }