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) } } }