Pure-Go tests for formatters, layout resolution, and validators — no fixtures, no external processes. Targets previously-zero functions the triage scan flagged as low-hanging fruit. cli 55% -> 65% paths 64% -> 91% system 65% -> 75% vmdns 72% -> 86% toolingplan 73% -> 78% Total 52.6% -> 54.0%.
23 lines
585 B
Go
23 lines
585 B
Go
package toolingplan
|
|
|
|
import "testing"
|
|
|
|
func TestFirstMeaningfulLine(t *testing.T) {
|
|
cases := []struct {
|
|
in, want string
|
|
}{
|
|
{"", ""},
|
|
{"\n\n\n", ""},
|
|
{" \n \n", ""},
|
|
{"# just a comment\n# another\n", ""},
|
|
{"1.75.0\n", "1.75.0"},
|
|
{" 1.75.0 ", "1.75.0"},
|
|
{"# pinned toolchain\n1.75.0\nmore junk\n", "1.75.0"},
|
|
{"\n\n stable-x86_64-unknown-linux-gnu \n", "stable-x86_64-unknown-linux-gnu"},
|
|
}
|
|
for _, tc := range cases {
|
|
if got := firstMeaningfulLine(tc.in); got != tc.want {
|
|
t.Errorf("firstMeaningfulLine(%q) = %q, want %q", tc.in, got, tc.want)
|
|
}
|
|
}
|
|
}
|