Skip to content

Commit

Permalink
Merge pull request #44 from uji/master
Browse files Browse the repository at this point in the history
refactoring colorable_test.go
  • Loading branch information
mattn committed Feb 21, 2020
2 parents c742d6f + 7a9f6e7 commit 617ccec
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions colorable_test.go
Expand Up @@ -17,8 +17,7 @@ func checkEncoding(t *testing.T, data []byte) {
t.FailNow()
}
// TODO move colorable wrapping outside the test
c := NewNonColorable(b)
c.Write(data)
NewNonColorable(b).Write(data)
if b.Len() != len(data) {
t.Fatalf("%d bytes expected, got %d", len(data), b.Len())
}
Expand Down Expand Up @@ -66,17 +65,15 @@ func TestNonColorableNil(t *testing.T) {

func TestNonColorableESC(t *testing.T) {
var b bytes.Buffer
c := NewNonColorable(&b)
c.Write([]byte{0x1b})
NewNonColorable(&b).Write([]byte{0x1b})
if b.Len() > 0 {
t.Fatalf("0 bytes expected, got %d", b.Len())
}
}

func TestNonColorableBadESC(t *testing.T) {
var b bytes.Buffer
c := NewNonColorable(&b)
c.Write([]byte{0x1b, 0x1b})
NewNonColorable(&b).Write([]byte{0x1b, 0x1b})
if b.Len() > 0 {
t.Fatalf("0 bytes expected, got %d", b.Len())
}
Expand Down

0 comments on commit 617ccec

Please sign in to comment.