Skip to content

Commit

Permalink
Addtional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Sep 9, 2019
1 parent 1ffa03f commit 3c43335
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions processor/printer/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ func WriteColored(content []byte, locations map[string][]int, in string, out str
}

// Go for the greatest value of end
y := v + len(key) -1
y := v + len(key) - 1
if y > end {
end = y
}
}
}
}


str.WriteByte(x)

if i == end {
Expand Down
13 changes: 13 additions & 0 deletions processor/printer/standard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,16 @@ func TestWriteColoredOverlapStart(t *testing.T) {
t.Error("Expected", expected, "got", got)
}
}

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

got := WriteColored([]byte("THIS"), loc, "__", "__")

expected := "__THIS__"
if got != expected {
t.Error("Expected", expected, "got", got)
}
}

0 comments on commit 3c43335

Please sign in to comment.