diff options
author | EuAndreh <eu@euandre.org> | 2025-05-04 09:45:46 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-05-04 09:45:46 -0300 |
commit | 0735b6e8ceb5525c43156b3c9ec172979eb5e65c (patch) | |
tree | f60df966782a8639fb5a6876e0e7cd29aa80fae5 /tests/cli-opts.sh | |
parent | Add i18n for manpages (diff) | |
download | uuid-0735b6e8ceb5525c43156b3c9ec172979eb5e65c.tar.gz uuid-0735b6e8ceb5525c43156b3c9ec172979eb5e65c.tar.xz |
tests/{cli-opts,integration}.sh: Add test implementations
Diffstat (limited to '')
-rwxr-xr-x | tests/cli-opts.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh index e69de29..39f01f4 100755 --- a/tests/cli-opts.sh +++ b/tests/cli-opts.sh @@ -0,0 +1,54 @@ +#!/bin/sh +set -eu + +. tests/lib.sh + + +test_generates_uuid_with_0_args() { + testing 'generates UUID with 0 arguments' + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./uuid.bin 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 0 + assert_empty_stderr + rm "$OUT" "$ERR" + + test_ok +} + +test_checks_string_with_1_arg() { + testing 'checks string with 1 arg' + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./uuid.bin 'cac94e13-41fa-40c4-bd46-5b7b3b46c09e' 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 0 + assert_empty_stdout + assert_empty_stderr + rm "$OUT" "$ERR" + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./uuid.bin 'bad-uuid-string' 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 3 + assert_empty_stdout + assert_stderr "uuid: str isn't of the correct length" + rm "$OUT" "$ERR" + + test_ok +} + + + +test_generates_uuid_with_0_args +test_checks_string_with_1_arg |