summaryrefslogtreecommitdiff
path: root/src/ansi_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/ansi_test.go
parent1fc565984244bdaf21e736bb9a129fff0de7cab1 (diff)
downloadfzf-3b5ae0f8a2ccdbad2656109c44ec7fb7322c7a67.tar.gz
Fix failing unit tests on ANSI attributes
Diffstat (limited to 'src/ansi_test.go')
-rw-r--r--src/ansi_test.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ansi_test.go b/src/ansi_test.go
index a80e98ad..0ba9e400 100644
--- a/src/ansi_test.go
+++ b/src/ansi_test.go
@@ -3,13 +3,19 @@ package fzf
import (
"fmt"
"testing"
+
+ "github.com/junegunn/fzf/src/curses"
)
func TestExtractColor(t *testing.T) {
assert := func(offset ansiOffset, b int32, e int32, fg int, bg int, bold bool) {
+ var attr curses.Attr
+ if bold {
+ attr = curses.Bold
+ }
if offset.offset[0] != b || offset.offset[1] != e ||
- offset.color.fg != fg || offset.color.bg != bg || offset.color.bold != bold {
- t.Error(offset, b, e, fg, bg, bold)
+ offset.color.fg != fg || offset.color.bg != bg || offset.color.attr != attr {
+ t.Error(offset, b, e, fg, bg, attr)
}
}
@@ -121,7 +127,7 @@ func TestExtractColor(t *testing.T) {
if len(*offsets) != 1 {
t.Fail()
}
- if state.fg != 2 || state.bg != -1 || !state.bold {
+ if state.fg != 2 || state.bg != -1 || state.attr == 0 {
t.Fail()
}
assert((*offsets)[0], 6, 11, 2, -1, true)
@@ -132,7 +138,7 @@ func TestExtractColor(t *testing.T) {
if len(*offsets) != 1 {
t.Fail()
}
- if state.fg != 2 || state.bg != -1 || !state.bold {
+ if state.fg != 2 || state.bg != -1 || state.attr == 0 {
t.Fail()
}
assert((*offsets)[0], 0, 11, 2, -1, true)
@@ -143,7 +149,7 @@ func TestExtractColor(t *testing.T) {
if len(*offsets) != 2 {
t.Fail()
}
- if state.fg != 200 || state.bg != 100 || state.bold {
+ if state.fg != 200 || state.bg != 100 || state.attr > 0 {
t.Fail()
}
assert((*offsets)[0], 0, 6, 2, -1, true)