From 21ab65979ff39e095a366c7d8f5b242516ff8146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Sat, 10 Aug 2019 06:04:13 -0500 Subject: [PATCH] Covered the remaining semver flags for inc plugin. --- tests/filter_inc_tests.rs | 44 +++++++++++++++++++++++++++++++++++++-- tests/tests.rs | 11 ---------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/tests/filter_inc_tests.rs b/tests/filter_inc_tests.rs index bc038f5cf..d6f1aff8c 100644 --- a/tests/filter_inc_tests.rs +++ b/tests/filter_inc_tests.rs @@ -56,7 +56,7 @@ fn by_one_without_passing_field() { } #[test] -fn semversion() { +fn semversion_major_inc() { Playground::setup_for("plugin_inc_test_3") .with_files(vec![FileWithContent( "sample.toml", @@ -76,7 +76,7 @@ fn semversion() { } #[test] -fn semversion_without_passing_field() { +fn semversion_minor_inc() { Playground::setup_for("plugin_inc_test_4") .with_files(vec![FileWithContent( "sample.toml", @@ -89,6 +89,46 @@ fn semversion_without_passing_field() { nu!( output, cwd("tests/fixtures/nuplayground/plugin_inc_test_4"), + "open sample.toml | inc package.version --minor | get package.version | echo $it" + ); + + assert_eq!(output, "0.2.0"); +} + +#[test] +fn semversion_patch_inc() { + Playground::setup_for("plugin_inc_test_5") + .with_files(vec![FileWithContent( + "sample.toml", + r#" + [package] + version = "0.1.3" + "#, + )]); + + nu!( + output, + cwd("tests/fixtures/nuplayground/plugin_inc_test_5"), + "open sample.toml | inc package.version --patch | get package.version | echo $it" + ); + + assert_eq!(output, "0.1.4"); +} + +#[test] +fn semversion_without_passing_field() { + Playground::setup_for("plugin_inc_test_6") + .with_files(vec![FileWithContent( + "sample.toml", + r#" + [package] + version = "0.1.3" + "#, + )]); + + nu!( + output, + cwd("tests/fixtures/nuplayground/plugin_inc_test_6"), "open sample.toml | get package.version | inc --patch | echo $it" ); diff --git a/tests/tests.rs b/tests/tests.rs index 727b32324..cc20c972f 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -23,17 +23,6 @@ fn external_has_correct_quotes() { assert_eq!(output, r#""hello world""#); } -#[test] -fn inc_plugin() { - nu!( - output, - cwd("tests/fixtures/formats"), - "open sgml_description.json | get glossary.GlossDiv.GlossList.GlossEntry.Height | inc | echo $it" - ); - - assert_eq!(output, "11"); -} - #[test] fn add_plugin() { nu!(output,