cn tests: strict mode, positive assertions before removals

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-24 20:05:48 -04:00
co-authored by Claude Fable 5
parent bc84b808fe
commit 9baecc928d
+10 -3
View File
@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
source "$(dirname -- "${BASH_SOURCE[0]}")/base-test.sh" source "$(dirname -- "${BASH_SOURCE[0]}")/base-test.sh"
export OMARCHY_PATH="$ROOT" export OMARCHY_PATH="$ROOT"
@@ -30,13 +32,15 @@ grep -q '^registry=https://registry.npmmirror.com$' "$HOME/.npmrc" || fail "npm
grep -q '^save-exact=true$' "$HOME/.npmrc" || fail "unrelated npmrc keys preserved" grep -q '^save-exact=true$' "$HOME/.npmrc" || fail "unrelated npmrc keys preserved"
pass "dev-mirror apply china manages npm registry non-destructively" pass "dev-mirror apply china manages npm registry non-destructively"
# Dev-mirror: cargo official leaves no crates-io takeover # Dev-mirror: cargo china installs the block, official removes it completely
omarchy-cn-dev-mirror-apply china --target cargo > /dev/null omarchy-cn-dev-mirror-apply china --target cargo > /dev/null
grep -q 'replace-with = "omarchycn"' "$HOME/.cargo/config.toml" || fail "cargo china writes source replacement"
grep -q 'rsproxy.cn' "$HOME/.cargo/config.toml" || fail "cargo china points at the registry URL"
omarchy-cn-dev-mirror-apply official --target cargo > /dev/null omarchy-cn-dev-mirror-apply official --target cargo > /dev/null
if grep -q "crates-io" "$HOME/.cargo/config.toml"; then if grep -q "crates-io" "$HOME/.cargo/config.toml"; then
fail "cargo official removes managed source block" fail "cargo official removes managed source block"
fi fi
pass "dev-mirror cargo official removes the managed block" pass "dev-mirror cargo china installs and official removes the block"
# IME: profile installs rime as default, hotkey surgery keeps other sections # IME: profile installs rime as default, hotkey surgery keeps other sections
mkdir -p "$HOME/.config/fcitx5" mkdir -p "$HOME/.config/fcitx5"
@@ -46,8 +50,11 @@ printf '[Behavior]\nShareInputState=No\n\n[Hotkey/TriggerKeys]\n0=Zenkaku_Hankak
omarchy-cn-ime-hotkey super-space > /dev/null omarchy-cn-ime-hotkey super-space > /dev/null
grep -q '^ShareInputState=No$' "$HOME/.config/fcitx5/config" || fail "hotkey surgery preserves other sections" grep -q '^ShareInputState=No$' "$HOME/.config/fcitx5/config" || fail "hotkey surgery preserves other sections"
grep -q '^0=Super+space$' "$HOME/.config/fcitx5/config" || fail "hotkey surgery sets trigger" grep -q '^0=Super+space$' "$HOME/.config/fcitx5/config" || fail "hotkey surgery sets trigger"
grep -q 'SUPER + ALT + SPACE' "$HOME/.config/hypr/bindings.lua" || fail "menu migration block written" grep -q 'hl.unbind("SUPER + SPACE")' "$HOME/.config/hypr/bindings.lua" || fail "menu key unbound"
grep -q 'hl.unbind("SUPER + ALT + SPACE")' "$HOME/.config/hypr/bindings.lua" || fail "apps menu key unbound before rebind"
grep -q 'o.bind("SUPER + ALT + SPACE", "Omarchy menu"' "$HOME/.config/hypr/bindings.lua" || fail "menu rebound to Super+Alt+Space"
omarchy-cn-ime-hotkey ctrl-space > /dev/null omarchy-cn-ime-hotkey ctrl-space > /dev/null
grep -q '^0=Control+space$' "$HOME/.config/fcitx5/config" || fail "ctrl-space restores Control+space trigger"
if grep -q 'OmarchyCN ime hotkey begin' "$HOME/.config/hypr/bindings.lua"; then if grep -q 'OmarchyCN ime hotkey begin' "$HOME/.config/hypr/bindings.lua"; then
fail "ctrl-space removes migration block" fail "ctrl-space removes migration block"
fi fi