Skip to content

Commit

Permalink
Add unit test for checking same width as a single word wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Maryniuk committed Jul 29, 2019
1 parent 66e218f commit 22edad1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wraptext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,13 @@ func TestWrapDefault150(t *testing.T) {
assert.Assert(t, len(line) <= 150)
}
}

// Test same length data. This should not be wrapped, but stay "at the edge".
func TestWrapSameSize(t *testing.T) {
somePhrase := "Supercalifragilisticexpialidocious"
expected := []string{somePhrase}
result := NewTextWrap().SetWidth(len(somePhrase)).Wrap(somePhrase)

assert.Assert(t, len(result) == len(expected))
assert.Equal(t, somePhrase, result[0])
}

0 comments on commit 22edad1

Please sign in to comment.