Skip to content

Commit d12e889

Browse files
committed
test(cli): align hook tests with non-blocking matcher (Grep|Glob)
The cli_upsert_claude_hook_fresh / _existing tests still asserted the old matcher 'Grep|Glob|Read', missed by the previous hook-augment commit. Update them to mirror what scripts/smoke-test.sh now enforces: exact matcher value '"Grep|Glob"' present AND 'Glob|Read' absent. The second assertion regress-protects against re-introducing Read into the matcher (issue #362).
1 parent c29e6d5 commit d12e889

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tests/test_cli.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,11 @@ TEST(cli_upsert_claude_hook_fresh) {
19071907
const char *data = read_test_file(settingspath);
19081908
ASSERT_NOT_NULL(data);
19091909
ASSERT(strstr(data, "PreToolUse") != NULL);
1910-
ASSERT(strstr(data, "Grep|Glob|Read") != NULL);
1910+
/* Matcher excludes Read per issue #362 (gating Read breaks the
1911+
* read-before-edit invariant). Assert exact matcher value AND that no
1912+
* Read-chained matcher slipped back in. */
1913+
ASSERT(strstr(data, "\"Grep|Glob\"") != NULL);
1914+
ASSERT(strstr(data, "Glob|Read") == NULL);
19111915
ASSERT(strstr(data, "cbm-code-discovery-gate") != NULL);
19121916

19131917
test_rmdir_r(tmpdir);
@@ -1932,8 +1936,9 @@ TEST(cli_upsert_claude_hook_existing) {
19321936

19331937
const char *data = read_test_file(settingspath);
19341938
ASSERT_NOT_NULL(data);
1935-
/* Our hook added */
1936-
ASSERT(strstr(data, "Grep|Glob|Read") != NULL);
1939+
/* Our hook added with the non-blocking matcher (issue #362). */
1940+
ASSERT(strstr(data, "\"Grep|Glob\"") != NULL);
1941+
ASSERT(strstr(data, "Glob|Read") == NULL);
19371942
/* Existing hook preserved */
19381943
ASSERT(strstr(data, "Bash") != NULL);
19391944
ASSERT(strstr(data, "firewall") != NULL);

0 commit comments

Comments
 (0)