diff --git a/tests/filter_inc_tests.rs b/tests/filter_inc_tests.rs index 7c16255e48..430c3076c1 100644 --- a/tests/filter_inc_tests.rs +++ b/tests/filter_inc_tests.rs @@ -15,8 +15,8 @@ fn can_only_apply_one() { } #[test] -fn regular_field_by_one() { - Playground::setup_for("plugin_inc_by_one_test") +fn by_one_with_field_passed() { + Playground::setup_for("plugin_inc_by_one_with_field_passed_test") .with_files(vec![FileWithContent( "sample.toml", r#" @@ -27,13 +27,34 @@ fn regular_field_by_one() { nu!( output, - cwd("tests/fixtures/nuplayground/plugin_inc_by_one_test"), + cwd("tests/fixtures/nuplayground/plugin_inc_by_one_with_field_passed_test"), "open sample.toml | inc package.edition | get package.edition | echo $it" ); assert_eq!(output, "2019"); } +#[test] +fn by_one_with_no_field_passed() { + Playground::setup_for("plugin_inc_by_one_with_no_field_passed_test") + .with_files(vec![FileWithContent( + "sample.toml", + r#" + [package] + contributors = "2" + "#, + )]); + + nu!( + output, + cwd("tests/fixtures/nuplayground/plugin_inc_by_one_with_no_field_passed_test"), + "open sample.toml | get package.contributors | inc | echo $it" + ); + + assert_eq!(output, "3"); +} + + #[test] fn semversion_major_inc() { Playground::setup_for("plugin_inc_major_semversion_test") diff --git a/tests/helpers/mod.rs b/tests/helpers/mod.rs index 5defb1356a..0df348f946 100644 --- a/tests/helpers/mod.rs +++ b/tests/helpers/mod.rs @@ -150,7 +150,6 @@ impl Playground { self } - pub fn glob_vec(pattern: &str) -> Vec { glob(pattern).unwrap().map(|r| r.unwrap()).collect() }