test: Table tests now view full output.

This commit is contained in:
2026-06-15 19:28:30 -04:00
parent 4600c81401
commit e17d04c93d

View File

@@ -116,12 +116,22 @@ test_render_table_normal :: proc(t: ^testing.T) {
output := strings.to_string(b) output := strings.to_string(b)
testing.expect(t, strings.contains(output, "Name"), "header 'Name' missing from output") expected := `┌──────┬─────────────────────────┐
testing.expect(t, strings.contains(output, "Path"), "header 'Path' missing from output") │ Name │ Path │
testing.expect(t, strings.contains(output, "foo"), "cell 'foo' missing from output") ├──────┼─────────────────────────┤
testing.expect(t, strings.contains(output, "/home/user/.env"), "cell '/home/user/.env' missing from output") │ foo │ /home/user/.env │
testing.expect(t, strings.contains(output, "bar"), "cell 'bar' missing from output") │ bar │ /home/user/project/.env │
testing.expect(t, strings.contains(output, "/home/user/project/.env"), "cell '/home/user/project/.env' missing") └──────┴─────────────────────────┘
`
testing.expect(
t,
output == expected,
fmt.tprintf(
"table output mismatch\n--- expected ---\n%s\n--- got ---\n%s\n",
expected,
output,
),
)
} }
@(test) @(test)
@@ -138,7 +148,20 @@ test_render_table_empty :: proc(t: ^testing.T) {
output := strings.to_string(b) output := strings.to_string(b)
testing.expect(t, strings.contains(output, "Name"), "header 'Name' missing from output") expected := `┌──────┐
│ Name │
├──────┤
└──────┘
`
testing.expect(
t,
output == expected,
fmt.tprintf(
"table output mismatch\n--- expected ---\n%s\n--- got ---\n%s\n",
expected,
output,
),
)
} }
@(test) @(test)
@@ -155,7 +178,21 @@ test_render_table_unicode :: proc(t: ^testing.T) {
output := strings.to_string(b) output := strings.to_string(b)
testing.expect(t, strings.contains(output, "Available"), "unicode cell content missing") expected := `┌─────────────┬────────┐
testing.expect(t, strings.contains(output, "Missing"), "unicode cell content missing") │ Status │ Detail │
├─────────────┼────────┤
│ ✓ Available │ ok │
│ ✗ Missing │ fail │
└─────────────┴────────┘
`
testing.expect(
t,
output == expected,
fmt.tprintf(
"table output mismatch\n--- expected ---\n%s\n--- got ---\n%s\n",
expected,
output,
),
)
} }