From 2f6f5e0920efd60150bbd7c93cefce7281d68c78 Mon Sep 17 00:00:00 2001 From: danix Date: Thu, 11 Jun 2026 10:10:16 +0200 Subject: feat: help screen + main dispatch Co-Authored-By: Claude Opus 4.8 --- tests/wallp.bats | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/wallp.bats') diff --git a/tests/wallp.bats b/tests/wallp.bats index ad4b9bf..0d6fc7e 100644 --- a/tests/wallp.bats +++ b/tests/wallp.bats @@ -237,3 +237,33 @@ teardown() { [ "$status" -eq 1 ] [[ "$output" == *"no display"* ]] } + +@test "bare invocation shows help" { + unset WAYLAND_DISPLAY + run main + [ "$status" -eq 0 ] + [[ "$output" == *"Usage"* ]] +} + +@test "unknown flag errors with help" { + unset WAYLAND_DISPLAY + run main --bogus + [ "$status" -eq 1 ] + [[ "$output" == *"Usage"* ]] +} + +@test "bootstrap on missing conf exits zero without setting wallpaper" { + unset WAYLAND_DISPLAY + run main --restore + [ "$status" -eq 0 ] + [ ! -e "$HOME/.cache/wallp/H.pid" ] +} + +@test "theme flag honored through main with restore" { + unset WAYLAND_DISPLAY + mkdir -p "$HOME/.config/wallp" + printf '%s\n' 'OUTPUT_H=DP-1' 'OUTPUT_V=DP-3' \ + 'DEFAULT_H=/dh.png' 'DEFAULT_V=/dv.png' > "$HOME/.config/wallp/wallp.conf" + main --restore --theme tflag + [ "$(cat "$HOME/.config/wallp/theme")" = "tflag" ] +} -- cgit v1.2.3