34 lines
893 B
Bash
Executable File
34 lines
893 B
Bash
Executable File
#!/bin/bash
|
|
|
|
source "$(dirname "$0")/base-test.sh"
|
|
|
|
test_tmp=$(mktemp -d)
|
|
trap 'rm -rf "$test_tmp"' EXIT
|
|
|
|
mock_bin="$test_tmp/bin"
|
|
hyprctl_log="$test_tmp/hyprctl.log"
|
|
mkdir -p "$mock_bin"
|
|
|
|
cat >"$mock_bin/hyprctl" <<'SH'
|
|
#!/bin/bash
|
|
|
|
if [[ $1 == "clients" ]]; then
|
|
printf '[{"address":"0xabc"},{"address":"0xdef"}]\n'
|
|
else
|
|
printf '%s\n' "$*" >>"$HYPRCTL_LOG"
|
|
fi
|
|
SH
|
|
chmod +x "$mock_bin/hyprctl"
|
|
|
|
PATH="$mock_bin:$PATH" HYPRCTL_LOG="$hyprctl_log" "$ROOT/bin/omarchy-hyprland-window-close-all"
|
|
|
|
expected_log="$test_tmp/expected.log"
|
|
cat >"$expected_log" <<'EOF'
|
|
dispatch hl.dsp.window.close({ window = "address:0xabc" })
|
|
dispatch hl.dsp.window.close({ window = "address:0xdef" })
|
|
dispatch hl.dsp.focus({ workspace = "1" })
|
|
EOF
|
|
|
|
diff -u "$expected_log" "$hyprctl_log" || fail "close-all targets each window with the Lua dispatcher"
|
|
pass "close-all targets each window with the Lua dispatcher"
|