mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 12:39:35 +02:00
Add explicit toggle states
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||
|
||||
TMPDIR=""
|
||||
|
||||
export PATH="$ROOT/bin:$PATH"
|
||||
|
||||
cleanup() {
|
||||
[[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
test_home="$TMPDIR/home"
|
||||
flag="$test_home/.local/state/omarchy/toggles/example"
|
||||
bar_flag="$test_home/.local/state/omarchy/toggles/bar-off"
|
||||
|
||||
HOME="$test_home" omarchy-toggle example on
|
||||
[[ -f $flag ]] || fail "generic toggle enables explicit on state"
|
||||
pass "generic toggle enables explicit on state"
|
||||
|
||||
HOME="$test_home" omarchy-toggle example on
|
||||
[[ -f $flag ]] || fail "generic toggle on is idempotent"
|
||||
pass "generic toggle on is idempotent"
|
||||
|
||||
HOME="$test_home" omarchy-toggle example off
|
||||
[[ ! -f $flag ]] || fail "generic toggle disables explicit off state"
|
||||
pass "generic toggle disables explicit off state"
|
||||
|
||||
HOME="$test_home" omarchy-toggle example
|
||||
[[ -f $flag ]] || fail "generic toggle flips disabled state on"
|
||||
pass "generic toggle flips disabled state on"
|
||||
|
||||
HOME="$test_home" omarchy-toggle example toggle
|
||||
[[ ! -f $flag ]] || fail "generic toggle flips enabled state off"
|
||||
pass "generic toggle flips enabled state off"
|
||||
|
||||
HOME="$test_home" omarchy-toggle-bar on
|
||||
[[ -f $bar_flag ]] || fail "bar on enables bar-off toggle"
|
||||
pass "bar on enables bar-off toggle"
|
||||
|
||||
HOME="$test_home" omarchy-toggle-bar on
|
||||
[[ -f $bar_flag ]] || fail "bar on is idempotent"
|
||||
pass "bar on is idempotent"
|
||||
|
||||
HOME="$test_home" omarchy-toggle-bar off
|
||||
[[ ! -f $bar_flag ]] || fail "bar off disables bar-off toggle"
|
||||
pass "bar off disables bar-off toggle"
|
||||
Reference in New Issue
Block a user