Skip to content

Commit

Permalink
tui test
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Sep 8, 2019
1 parent a43f015 commit 3967af1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions processor/tui_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package processor

import "testing"

func TestColourSearchStringEmpty(t *testing.T) {
content := colorSearchString(&FileJob{})

if content != "" {
t.Error("Expected empty content")
}
}

func TestColourSearchStringContent(t *testing.T) {
content := colorSearchString(&FileJob{
Content: []byte("this is some content"),
Locations: nil,
})

if content != "" {
t.Error("Expected empty content")
}
}

func TestColourSearchStringContentWithMatch(t *testing.T) {
loc := map[string][]int{}
loc["this"] = []int{0}

content := colorSearchString(&FileJob{
Content: []byte("this is some content"),
Locations: loc,
})

if content != "[red]this[white] is some content" {
t.Error("Expected empty content")
}
}

0 comments on commit 3967af1

Please sign in to comment.