summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-03-30 19:51:14 +0100
committerAki <please@ignore.pl>2024-03-30 19:51:14 +0100
commit451560809c7478af782b9675d03406f221021eb0 (patch)
treee93a4dbb7400e4df78f41ffdc438d092ff8aeccd /test.sh
parent3ee6230f47850c966147655b383eeea2b85ca052 (diff)
downloadnt-master.zip
nt-master.tar.gz
nt-master.tar.bz2
Add quick spec testsHEADmaster
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..14874b4
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+nt_() {
+ ./nt "$@"
+} >/dev/null
+
+
+fail() {
+ echo "$@"
+ exit 1
+} >&2
+
+
+nt_ && fail "shall return non-zero exit code on no args"
+nt_ 0 && fail "shall return non-zero exit code on just one arg"
+nt_ 0 - && fail "shall return non-zero exit code on zero reps"
+nt_ -1 - && fail "shall return non-zero exit code on negative reps"
+nt_ abc - && fail "shall return non-zero exit code on invalid number"
+nt_ 20 - || fail "shall return zero exit code with one component to repeat"
+nt_ 10 - = + || fail "shall return zero exit code with more components"
+echo ok