diff options
author | EuAndreh <eu@euandre.org> | 2024-08-11 07:12:53 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-08-11 07:12:53 -0300 |
commit | db44fd6aa6e0c3c9ab826e6f217cb555465c0fc4 (patch) | |
tree | c680e3b1874186c006fe08ddbceeed61cc7886ca /tests/cli-opts.sh | |
parent | Initial empty commit (diff) | |
download | untls-db44fd6aa6e0c3c9ab826e6f217cb555465c0fc4.tar.gz untls-db44fd6aa6e0c3c9ab826e6f217cb555465c0fc4.tar.xz |
Initial implementation: copy structure from "binder" project
Diffstat (limited to 'tests/cli-opts.sh')
-rwxr-xr-x | tests/cli-opts.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh new file mode 100755 index 0000000..bcceaa2 --- /dev/null +++ b/tests/cli-opts.sh @@ -0,0 +1,47 @@ +#!/bin/sh +set -eu + +. tests/lib.sh + + +test_needs_4_arguments() { + testing 'needs 4 arguments' + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./untls.bin 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 2 + assert_empty_stdout + assert_usage "$ERR" + rm -f "$OUT" "$ERR" + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./untls.bin FROM-ADDR 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 2 + assert_empty_stdout + assert_usage "$ERR" + rm -f "$OUT" "$ERR" + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + trap 'rm -f "$OUT" "$ERR"' EXIT + STATUS=0 + ./untls.bin cert.pem key.pem TO-ADDR 1>"$OUT" 2>"$ERR" || STATUS=$? + assert_status 2 + assert_empty_stdout + assert_usage "$ERR" + rm -f "$OUT" "$ERR" + + test_ok +} + + +test_needs_4_arguments |