mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
52 lines
1.5 KiB
Bash
52 lines
1.5 KiB
Bash
#!/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"
|