@@ -239,6 +239,84 @@ else
239239 print_fail " Should show trash path"
240240fi
241241
242+ print_scenario " Search/Filter Trash Contents"
243+
244+ print_test " Create files with unique patterns for filter testing"
245+ echo " project code" > uniqueproject123_config.js
246+ echo " app code" > uniqueapp456_settings.json
247+ echo " readme text" > uniqueREADME789.md
248+ echo " test code" > uniquehelper999_test.py
249+ rm uniqueproject123_config.js uniqueapp456_settings.json uniqueREADME789.md uniquehelper999_test.py
250+ print_pass " Created and deleted 4 files with unique patterns"
251+
252+ print_test " Filter by filename pattern - includes match"
253+ filter_output=$( rm --list-trash " uniqueproject123" 2>&1 )
254+ if echo " $filter_output " | grep -q " uniqueproject123_config.js" ; then
255+ print_pass " Filter includes matching file (uniqueproject123)"
256+ else
257+ print_fail " Filter should show uniqueproject123_config.js"
258+ fi
259+
260+ print_test " Filter by filename pattern - excludes non-match"
261+ filter_output=$( rm --list-trash " uniqueproject123" 2>&1 )
262+ if ! echo " $filter_output " | grep -q " uniqueapp456_settings.json" ; then
263+ print_pass " Filter excludes non-matching file"
264+ else
265+ print_fail " Filter should not show uniqueapp456_settings.json when filtering by uniqueproject123"
266+ fi
267+
268+ print_test " Filter with different unique pattern"
269+ filter_output=$( rm --list-trash " helper999" 2>&1 )
270+ if echo " $filter_output " | grep -q " uniquehelper999_test.py" ; then
271+ print_pass " Filter shows matching file (helper999)"
272+ else
273+ print_fail " Filter should show uniquehelper999_test.py"
274+ fi
275+
276+ print_test " Filter with file extension pattern"
277+ filter_output=$( rm --list-trash " uniqueREADME789.md" 2>&1 )
278+ if echo " $filter_output " | grep -q " uniqueREADME789.md" && \
279+ ! echo " $filter_output " | grep -q " uniquehelper999_test.py" ; then
280+ print_pass " Filter matches specific markdown file"
281+ else
282+ print_fail " Filter should show uniqueREADME789.md but not .py files"
283+ fi
284+
285+ print_test " Filter with guaranteed no matches"
286+ filter_output=$( rm --list-trash " xYz123NoMatchEver456" 2>&1 )
287+ if echo " $filter_output " | grep -q " No files found matching pattern" ; then
288+ print_pass " Filter correctly reports no matches"
289+ else
290+ print_fail " Should show 'No files found' message for non-existent pattern"
291+ fi
292+
293+ print_test " Case-insensitive filter test (uppercase)"
294+ filter_output=$( rm --list-trash " UNIQUEREADME789" 2>&1 )
295+ if echo " $filter_output " | grep -q " uniqueREADME789.md" ; then
296+ print_pass " Filter is case-insensitive (uppercase pattern)"
297+ else
298+ print_fail " Filter should match uniqueREADME789.md with uppercase pattern"
299+ fi
300+
301+ print_test " Case-insensitive filter test (lowercase)"
302+ filter_output=$( rm --list-trash " uniquereadme789" 2>&1 )
303+ if echo " $filter_output " | grep -q " uniqueREADME789.md" ; then
304+ print_pass " Filter is case-insensitive (lowercase pattern)"
305+ else
306+ print_fail " Filter should match uniqueREADME789.md with lowercase pattern"
307+ fi
308+
309+ print_test " List all trash without filter shows test files"
310+ list_output=$( rm --list-trash 2>&1 )
311+ if echo " $list_output " | grep -q " uniqueproject123_config.js" && \
312+ echo " $list_output " | grep -q " uniqueapp456_settings.json" && \
313+ echo " $list_output " | grep -q " uniqueREADME789.md" && \
314+ echo " $list_output " | grep -q " uniquehelper999_test.py" ; then
315+ print_pass " Listing all trash shows all test files"
316+ else
317+ print_fail " Should show all test files when no filter is provided"
318+ fi
319+
242320print_scenario " Direct Deletion (Bypass Trash)"
243321print_test " Create file for permanent deletion"
244322echo " disposable" > disposable.txt
0 commit comments