summaryrefslogtreecommitdiffstats
path: root/src/result_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-09-29 01:06:35 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-09-29 01:06:47 +0900
commit3b5ae0f8a2ccdbad2656109c44ec7fb7322c7a67 (patch)
treeef25de80c31dd675494a74f8b2d37e3df811ccb6 /src/result_test.go
parent1fc565984244bdaf21e736bb9a129fff0de7cab1 (diff)
Fix failing unit tests on ANSI attributes
Diffstat (limited to 'src/result_test.go')
-rw-r--r--src/result_test.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/result_test.go b/src/result_test.go
index c6832f1b..46c20fd9 100644
--- a/src/result_test.go
+++ b/src/result_test.go
@@ -97,16 +97,20 @@ func TestColorOffset(t *testing.T) {
item := Result{
item: &Item{
colors: &[]ansiOffset{
- ansiOffset{[2]int32{0, 20}, ansiState{1, 5, false}},
- ansiOffset{[2]int32{22, 27}, ansiState{2, 6, true}},
- ansiOffset{[2]int32{30, 32}, ansiState{3, 7, false}},
- ansiOffset{[2]int32{33, 40}, ansiState{4, 8, true}}}}}
+ ansiOffset{[2]int32{0, 20}, ansiState{1, 5, 0}},
+ ansiOffset{[2]int32{22, 27}, ansiState{2, 6, curses.Bold}},
+ ansiOffset{[2]int32{30, 32}, ansiState{3, 7, 0}},
+ ansiOffset{[2]int32{33, 40}, ansiState{4, 8, curses.Bold}}}}}
// [{[0 5] 9 false} {[5 15] 99 false} {[15 20] 9 false} {[22 25] 10 true} {[25 35] 99 false} {[35 40] 11 true}]
- colors := item.colorOffsets(offsets, 99, false, true)
+ colors := item.colorOffsets(offsets, 99, 0, true)
assert := func(idx int, b int32, e int32, c int, bold bool) {
+ var attr curses.Attr
+ if bold {
+ attr = curses.Bold
+ }
o := colors[idx]
- if o.offset[0] != b || o.offset[1] != e || o.color != c || o.bold != bold {
+ if o.offset[0] != b || o.offset[1] != e || o.color != c || o.attr != attr {
t.Error(o)
}
}