Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

blacklist_test.gno

0.66 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(cur realm, 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}