Search Apps Documentation Source Content File Folder Download Copy Actions Download

blacklist_test.gno

0.65 Kb · 19 lines
 1package namereg
 2
 3import "testing"
 4
 5// TestReservedNamesSorted enforces lexicographic ordering on reservedNames.
 6// The list is intended to be auditable at a glance and to grow over time;
 7// keeping it sorted makes diffs minimal and makes manual scanning for a
 8// given entry feasible. If this fails after a maintainer adds an entry,
 9// re-sort the slice rather than weakening the test.
10func TestReservedNamesSorted(t *testing.T) {
11	for i := 1; i < len(reservedNames); i++ {
12		if reservedNames[i-1] >= reservedNames[i] {
13			t.Errorf(
14				"reservedNames not sorted at index %d: %q should come after %q",
15				i, reservedNames[i-1], reservedNames[i],
16			)
17		}
18	}
19}