Adds filter test for named param.

This commit is contained in:
Thomas Hartmann 2019-10-15 20:58:46 +02:00
parent d32e97b812
commit e7b37bee08

View file

@ -383,6 +383,34 @@ fn converts_from_ssv_text_to_structured_table() {
}) })
} }
#[test]
fn converts_from_ssv_text_to_structured_table_with_separator_specified() {
Playground::setup("filter_from_ssv_test_1", |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 <none> 172.30.0.2 443/TCP
kubernetes-ro component=apiserver,provider=kubernetes <none> 172.30.0.1 80/TCP
"#,
)]);
let actual = nu!(
cwd: dirs.test(), h::pipeline(
r#"
open oc_get_svc.txt
| from-ssv -n 3
| nth 0
| get IP
| echo $it
"#
));
assert_eq!(actual, "172.30.78.158");
})
}
#[test] #[test]
fn converts_from_ssv_text_skipping_headers_to_structured_table() { fn converts_from_ssv_text_skipping_headers_to_structured_table() {
Playground::setup("filter_from_ssv_test_2", |dirs, sandbox| { Playground::setup("filter_from_ssv_test_2", |dirs, sandbox| {