Skip to content

Commit 4c2cd34

Browse files
committed
Add tests
Signed-off-by: Fatih Arslan <ftharsln@gmail.com>
1 parent 73e3e22 commit 4c2cd34

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

color_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ func TestColorEquals(t *testing.T) {
104104
}
105105
}
106106

107+
func TestColorEquals_DuplicateAttributes(t *testing.T) {
108+
ordered := New(FgRed, Bold).Add(FgRed)
109+
reordered := New(Bold, FgRed).Add(FgRed)
110+
differentCounts := New(FgRed, Bold).Add(Bold)
111+
112+
if !ordered.Equals(reordered) {
113+
t.Error("Colors with the same attributes in different orders are not equal")
114+
}
115+
116+
if ordered.Equals(differentCounts) {
117+
t.Error("Colors with different duplicate attribute counts are equal")
118+
}
119+
}
120+
107121
func TestNoColor(t *testing.T) {
108122
rb := new(bytes.Buffer)
109123
Output = rb

0 commit comments

Comments
 (0)