Yasuhiro Matsumoto 8 anos atrás
pai
commit
1fd7d14ff9
1 arquivos alterados com 10 adições e 0 exclusões
  1. 10 0
      colorable_test.go

+ 10 - 0
colorable_test.go

@@ -31,6 +31,16 @@ func TestEncoding(t *testing.T) {
 	checkEncoding(t, []byte{233})   // 'é' in Latin-1
 }
 
+func TestNonColorable(t *testing.T) {
+	var buf bytes.Buffer
+	want := "hello"
+	NewNonColorable(&buf).Write([]byte("\x1b[0m" + want + "\x1b[2J"))
+	got := buf.String()
+	if got != "hello" {
+		t.Fatalf("want %q but %q", "hello", got)
+	}
+}
+
 func TestColorable(t *testing.T) {
 	if runtime.GOOS == "windows" {
 		t.Skipf("skip this test on windows")