Test a calc's operand list, one empty-segment check, and an empty segment after a step up

This commit is contained in:
2026-10-05 12:25:22 +02:00
committed by Lillem4n
parent 5e56b44dfa
commit 3479f9cf98
5 changed files with 26 additions and 16 deletions
+11
View File
@@ -38,3 +38,14 @@ func TestNameSegmentsDropSelectorsAndStepsUp(t *testing.T) {
t.Errorf("NameSegments = %q, want [a c]", got)
}
}
func TestCheckSegmentsRefusesAnEmptySegment(t *testing.T) {
for _, segs := range [][]string{{""}, {"a", ""}, {"", "a"}, {"a", "", "b"}} {
if CheckSegments(segs) == nil {
t.Errorf("CheckSegments(%q) = nil, want an error", segs)
}
}
if err := CheckSegments([]string{"a", "[b]", "..", "c"}); err != nil {
t.Errorf("CheckSegments = %v, want nil", err)
}
}