forked from sloum/bombadillo
identified more issues, added tests
This commit is contained in:
parent
319138b189
commit
be34a9a809
|
@ -13,17 +13,84 @@ func Test_wrapLines_doesnt_break_indents(t *testing.T) {
|
|||
linelength int
|
||||
}{
|
||||
{
|
||||
//20 character input - should not wrap
|
||||
//indented long word - 20 characters - should not wrap
|
||||
[]string{indent + "012345678"},
|
||||
[]string{indent + "012345678"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//21 character input - should wrap
|
||||
[]string{indent + "0123456789"},
|
||||
//indented long word - 21 characters - should wrap
|
||||
[]string{indent + "0123456789"},
|
||||
[]string{indent + "012345678", indent + "9"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//indented really long word - should wrap
|
||||
[]string{indent + "0123456789zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"},
|
||||
[]string{
|
||||
indent + "012345678",
|
||||
indent + "9zzzzzzzz",
|
||||
indent + "zzzzzzzzz",
|
||||
indent + "zzzzzzzzz",
|
||||
indent + "zzzzz"},
|
||||
20,
|
||||
}, {
|
||||
//non-indented long word - 20 characters - should not wrap
|
||||
[]string{"01234567890123456789"},
|
||||
[]string{"01234567890123456789"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//non-indented long word - 21 characters - should wrap
|
||||
[]string{"01234567890123456789a"},
|
||||
[]string{"01234567890123456789", "a"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//non-indented really long word - should wrap
|
||||
[]string{"01234567890123456789zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"},
|
||||
[]string{
|
||||
"01234567890123456789",
|
||||
"zzzzzzzzzzzzzzzzzzzz",
|
||||
"zzzzzzzzzzzzzzzzzzzz",
|
||||
"zzzzzzzzzzzzzzzzzzzz",
|
||||
"zzzz"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//indented normal sentence - 20 characters - should not wrap
|
||||
[]string{indent + "it is her"},
|
||||
[]string{indent + "it is her"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//indented normal sentence - more than 20 characters - should wrap
|
||||
[]string{indent + "it is her favourite thing in the world"},
|
||||
[]string{
|
||||
indent + "it is her",
|
||||
indent + "favourite",
|
||||
indent + "thing in",
|
||||
indent + "the world",
|
||||
},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//non-indented normal sentence - 20 characters - should not wrap
|
||||
[]string{"it is her fav thingy"},
|
||||
[]string{"it is her fav thingy"},
|
||||
20,
|
||||
},
|
||||
{
|
||||
//non-indented normal sentence - more than 20 characters - should wrap
|
||||
[]string{"it is her favourite thing in the world"},
|
||||
[]string{
|
||||
"it is her favourite",
|
||||
"thing in the world",
|
||||
},
|
||||
20,
|
||||
},
|
||||
//TODO further tests
|
||||
//lines that are just spaces don't get misidentified as indents and then mangled
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
|
|
Loading…
Reference in New Issue