|
|
|
|
@@ -4,34 +4,13 @@
|
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
|
|
|
|
|
|
|
|
|
echo '--- test 1: plain text ---\n'
|
|
|
|
|
"$SCRIPT_DIR/whisper" --via telegram -m "Hello from whisper test" || true
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t telegram -m "Hello from whisper test" || true
|
|
|
|
|
|
|
|
|
|
echo '\n--- test 2: HTML formatting ---\n'
|
|
|
|
|
"$SCRIPT_DIR/whisper" --via telegram -m "<b>bold</b> <i>italic</i> <code>code</code>" || true
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t telegram -m "<b>bold</b> <i>italic</i> <code>code</code>" || true
|
|
|
|
|
|
|
|
|
|
echo '\n--- test 3: multiline ---\n'
|
|
|
|
|
MSG=$(printf 'Line one\nLine two\nLine three')
|
|
|
|
|
"$SCRIPT_DIR/whisper" --via telegram -m "$MSG" || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- test 4: template substitution ---\n'
|
|
|
|
|
mkdir -p "$HOME/.config/whisper/templates"
|
|
|
|
|
printf 'Deploy: {1} version {2}' > "$HOME/.config/whisper/templates/_test-deploy"
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t _test-deploy -p "myapp" "v1.0.0" || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- test 5: template with file injection ---\n'
|
|
|
|
|
printf 'log output here' > /tmp/_whisper-test-file.txt
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t _test-deploy -p "myapp" @/tmp/_whisper-test-file.txt || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- test 6: mutual exclusion (expect error) ---\n'
|
|
|
|
|
"$SCRIPT_DIR/whisper" -m "hello" -t _test-deploy -p "a" "b" 2>&1 || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- test 7: missing template (expect error) ---\n'
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t _nonexistent -p "x" 2>&1 || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- test 8: transport override via --via ---\n'
|
|
|
|
|
"$SCRIPT_DIR/whisper" --via telegram -t _test-deploy -p "myapp" "v2.0.0" || true
|
|
|
|
|
|
|
|
|
|
printf '\n--- cleanup ---\n'
|
|
|
|
|
rm -f "$HOME/.config/whisper/templates/_test-deploy" /tmp/_whisper-test-file.txt
|
|
|
|
|
"$SCRIPT_DIR/whisper" -t telegram -m "$MSG" || true
|
|
|
|
|
|
|
|
|
|
echo '\nAll tests done.\n'
|
|
|
|
|
|