24 lines
636 B
Go
24 lines
636 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package presentation
|
|
|
|
import "testing"
|
|
|
|
func TestIndentationCountsVisibleWhitespaceAndIgnoresBlankRows(t *testing.T) {
|
|
for _, trial := range []struct {
|
|
text string
|
|
level int
|
|
valid bool
|
|
}{
|
|
{"value", 0, true}, {" value ", 4, true}, {" \tvalue", 8, true},
|
|
{"\t \tvalue", 16, true}, {"\u00a0\u2003É", 2, true},
|
|
{"", 0, false}, {" ", 0, false}, {"\t ", 0, false},
|
|
} {
|
|
level, valid := Indentation_level([]rune(trial.text))
|
|
if level != trial.level || valid != trial.valid {
|
|
t.Fatalf("%q: %d %v", trial.text, level, valid)
|
|
}
|
|
}
|
|
}
|