commit 7d7a2162cf93f0c4711326ea64cb6f3d50c9dd3c parent 5ee030b6c18f0ba02163c0b8c80cd06da3329a68 Author: Natasha Kerensikova <natgh@instinctive.eu> Date: Fri, 28 Nov 2025 19:24:06 +0000 Grep action behavior is better tested Diffstat:
| M | spec/action_spec.sh | | | 25 | ++++++++++++++++++++++++- |
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/spec/action_spec.sh b/spec/action_spec.sh @@ -1424,7 +1424,7 @@ Describe 'Action Functions' grep() { @grep "$1"; } setup() { - @mkdir -p "${PREFIX}/subdir" + @mkdir -p "${PREFIX}/empty" "${PREFIX}/subdir" %putsn data >"${PREFIX}/non-match.age" %text >"${PREFIX}/subdir/match.age" #|non-match @@ -1448,6 +1448,7 @@ Describe 'Action Functions' When call do_grep "${PREFIX}" ot The status should be success The output should equal "$(result)" + The error should be blank End It 'outputs all the matching lines' @@ -1460,6 +1461,28 @@ Describe 'Action Functions' When call do_grep "${PREFIX}" -vea The status should be success The output should equal "$(result)" + The error should be blank + End + + It 'outputs nothing without matches' + When call do_grep "${PREFIX}" z + The status should be success + The output should be blank + The error should be blank + End + + It 'correctly displays matches in the root' + result(){ + %text + #|(B)(G)non-match(N): + #|data + #|(B)subdir/(G)match(N): + #|non-match + } + When call do_grep "${PREFIX}" a + The status should be success + The output should equal "$(result)" + The error should be blank End End