Sanitize terminal widget text
This commit is contained in:
committed by
Brandon McGinty
parent
8348a7083d
commit
770635955a
@@ -32,3 +32,14 @@ func TestCloseIsNonblockingAndIdempotent(t *testing.T) {
|
||||
t.Fatal("Close did not signal shutdown")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSafeRuneRemovesTerminalControlCharacters(t *testing.T) {
|
||||
for _, r := range []rune{'\x1b', '\x7f', '\u202e'} {
|
||||
if got := safeRune(r); got != ' ' {
|
||||
t.Errorf("safeRune(%U) = %U, want space", r, got)
|
||||
}
|
||||
}
|
||||
if got := safeRune('A'); got != 'A' {
|
||||
t.Fatalf("safeRune altered printable text: %U", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user