Covered the remaining semver flags for inc plugin.

This commit is contained in:
Andrés N. Robalino 2019-08-10 06:04:13 -05:00
parent e744237451
commit 21ab65979f
2 changed files with 42 additions and 13 deletions

View File

@ -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"
);

View File

@ -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,