Files
lush_grading/tasks/filesystem/multi_file_search.toml
Cormac Shannon 20e62f60f6 Reorganize task categories from opaque a/b to descriptive names
Replace category_a/category_b directories with algorithm, pipeline,
environment, filesystem, and process. Add separate mode field (solve/convert)
to decouple orchestration from capability grouping. Add per-category
summary and questionnaire breakdowns to both terminal report and HTML export.
2026-03-29 20:59:01 +01:00

31 lines
1.1 KiB
TOML

name = "multi_file_search"
category = "filesystem"
mode = "solve"
description = """
You are given a working directory containing several text files.
Read a search pattern (a simple string, not regex) from stdin.
Search all .txt files in the working directory for lines containing that pattern (case-sensitive).
Print matching results in the format: "filename:line_number:line_content"
Results should be sorted first by filename, then by line number.
Line numbers are 1-based.
"""
[[test_cases]]
stdin = "error"
expected_stdout = """app.txt:2:found an error here
app.txt:4:another error occurred
system.txt:1:error on startup"""
setup_files = { "app.txt" = "all good\nfound an error here\nno problem\nanother error occurred", "system.txt" = "error on startup\nrunning fine\nshutdown", "data.csv" = "error,value\n1,2" }
[[test_cases]]
stdin = "hello"
expected_stdout = """a.txt:1:hello world
b.txt:2:say hello"""
setup_files = { "a.txt" = "hello world\ngoodbye", "b.txt" = "greetings\nsay hello" }
[[test_cases]]
stdin = "notfound"
expected_stdout = ""
setup_files = { "test.txt" = "nothing matches here" }