aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-08-04 23:15:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-08-12 11:55:44 +0300
commit4791ec7dbb5116a26df896d0b38cd3a66ac64c95 (patch)
treec33c70f5c15ec9988dfcd0e2988668c1969fe05d /tests
parent46c7d448f27e8fc213c50cd241914b2d94e2e308 (diff)
Add standard-version utility
Diffstat (limited to 'tests')
-rw-r--r--tests/standard-version/buildfile6
-rw-r--r--tests/standard-version/driver.in8
-rw-r--r--tests/standard-version/testscript20
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/standard-version/buildfile b/tests/standard-version/buildfile
new file mode 100644
index 0000000..5fe61e5
--- /dev/null
+++ b/tests/standard-version/buildfile
@@ -0,0 +1,6 @@
+# file : tests/standard-version/buildfile
+# license : MIT; see accompanying LICENSE file
+
+import mods = libbutl.bash%bash{standard-version}
+
+exe{driver}: in{driver} $mods testscript
diff --git a/tests/standard-version/driver.in b/tests/standard-version/driver.in
new file mode 100644
index 0000000..f1df612
--- /dev/null
+++ b/tests/standard-version/driver.in
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+# file : tests/standard-version/driver.in
+# license : MIT; see accompanying LICENSE file
+
+@import libbutl/standard-version@
+
+butl_standard_version "$@"
diff --git a/tests/standard-version/testscript b/tests/standard-version/testscript
new file mode 100644
index 0000000..4ee17cc
--- /dev/null
+++ b/tests/standard-version/testscript
@@ -0,0 +1,20 @@
+# file : tests/standard-version/testscript
+# license : MIT; see accompanying LICENSE file
+
+: invalid-arguments
+:
+{
+ $* --is-snapshot 2>'error: missing version' == 3 : no-ver
+ $* '1.2.3' '1.0' 2>"error: unexpected argument '1.0'" == 3 : unexpected
+ $* '1.2' 2>"error: '.' expected after minor version" == 2 : no-minor
+}
+
+$* --is-snapshot '1.2.3-a.1.12345.abcdef' == 0 : snapshot-yes
+$* --is-snapshot '1.2.3-a.1' == 1 : snapshot-no
+$* --is-not-snapshot '1.2.3-a.1' == 0 : not-snapshot-yes
+$* --is-not-snapshot '1.2.3-a.1.12345.abcdef' == 1 : not-snapshot-no
+$* --is-version 'abc' == 2 : version-no
+
+$* --is-not-final --is-alpha '1.2.3-a.1.12345.abcdef' == 0 : not-final-alpha
+$* --is-beta --is-latest-snapshot '1.2.3-b.1.z' == 0 : beta-latest-snapshot
+$* --is-not-beta --is-beta '1.2.3-b.1.z' == 1 : opposite