summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tests/barTests/phbarTests.swift28
-rw-r--r--tasks/20261014-192052/TASK.md12
2 files changed, 39 insertions, 1 deletions
diff --git a/Tests/barTests/phbarTests.swift b/Tests/barTests/phbarTests.swift
index 982e728..3c44482 100644
--- a/Tests/barTests/phbarTests.swift
+++ b/Tests/barTests/phbarTests.swift
@@ -51,3 +51,31 @@ private func runCommand(_ command: String, env: [String: String] = [:]) throws -
let result = try runCommand("printf ' %s \\n\\nlast\\n' \"$BAR_RUNNER_TEST\"; test -n \"$PATH\"", env: ["BAR_RUNNER_TEST": "value"])
#expect(result.lines == [" value ", "", "last"])
}
+
+@Test func parsingEmptyOutputProducesNoCells() {
+ #expect(Runner.parse("") == [])
+}
+
+@Test func parsingRemovesOneFinalNewline() {
+ #expect(Runner.parse("cell\n") == ["cell"])
+ #expect(Runner.parse("cell") == ["cell"])
+}
+
+@Test func parsingPreservesInternalBlankLines() {
+ #expect(Runner.parse("first\n\n\nlast\n") == ["first", "", "", "last"])
+ #expect(Runner.parse("\nfirst") == ["", "first"])
+}
+
+@Test func parsingPreservesAdditionalTrailingBlankLines() {
+ #expect(Runner.parse("cell\n\n\n") == ["cell", "", ""])
+ #expect(Runner.parse("\n") == [""])
+ #expect(Runner.parse("\n\n") == ["", ""])
+}
+
+@Test func parsingPreservesLineOrder() {
+ #expect(Runner.parse("third\nfirst\nsecond\n") == ["third", "first", "second"])
+}
+
+@Test func parsingDoesNotTrimWhitespace() {
+ #expect(Runner.parse(" leading\ntrailing \n\t \t\n") == [" leading", "trailing ", "\t \t"])
+}
diff --git a/tasks/20261014-192052/TASK.md b/tasks/20261014-192052/TASK.md
index 8165a59..de0ca34 100644
--- a/tasks/20261014-192052/TASK.md
+++ b/tasks/20261014-192052/TASK.md
@@ -1,6 +1,6 @@
# Replace the placeholder test with focused protocol tests
-- STATUS: OPEN
+- STATUS: CLOSED
- PRIORITY: 140
- TAGS: review,quality,tests
@@ -13,3 +13,13 @@ Approach: Replace example() with named Swift Testing cases for Runner.parse: emp
Completion checks: swift test executes meaningful assertions and all pass. Tests describe public behavioral contracts rather than copying implementation logic or relying on the user's scripts/hardware. Keep process fixtures bounded and deterministic. No screenshot suite, testing dependency, or general mock framework is required.
Design constraint: Follow README.md: keep source-based configuration, no dependencies or plugin framework, and use the smallest readable change that makes the existing behavior reliable. This is a suggestion for individual review, not a deadline. Findings were recorded on 2026-10-14; re-check the current code before implementing.
+
+Completed 2026-10-15: the placeholder had already been replaced by the concurrent
+pipe-draining task. Added six named, direct Runner.parse tests covering empty
+output, one final newline, internal/leading blank lines, extra trailing blank
+lines, line order, and spaces/tabs. No production changes or process fixtures
+were needed. Highlight edge cases remain with task 20261014-191535, where their
+contract is to be defined; repeated-cell identity stays with its dedicated task.
+
+Validation: `swift test` passes all 19 tests, including the six new protocol
+tests. `git diff --check` passes.