Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
text: partial cleanup in conditional cases
- Loading branch information
1 parent
3128116
commit 26a0d9a
Showing
9 changed files
with
337 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package markdown | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRemoveLineBreak(t *testing.T) { | ||
tests := []struct { | ||
input string | ||
want string | ||
}{ | ||
{ | ||
"hello\nhello", | ||
"hello hello", | ||
}, | ||
{ | ||
"hello \nhello", | ||
"hello hello", | ||
}, | ||
{ | ||
"hello\n hello", | ||
"hello hello", | ||
}, | ||
{ | ||
" hello hello \n hello hello ", | ||
" hello hello hello hello ", | ||
}, | ||
{ | ||
" hello ", | ||
" hello ", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
assert.Equal(t, tt.want, removeLineBreak(tt.input)) | ||
} | ||
} |
13 changes: 6 additions & 7 deletions
13
testdata_result/Hard-wrapped paragraphs with list-like lines no empty line before block.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
In Markdown 1.0.0 and earlier. | ||
Version | ||
8. This line turns into a list item. | ||
Because a hard-wrapped line in the | ||
middle of a paragraph looked like a | ||
list item. | ||
Version 8. This line turns into a | ||
list item. Because a hard-wrapped | ||
line in the middle of a paragraph | ||
looked like a list item. | ||
|
||
Here's one with a bullet. | ||
* criminey. | ||
Here's one with a bullet. * | ||
criminey. |
13 changes: 6 additions & 7 deletions
13
testdata_result/Hard-wrapped paragraphs with list-like lines.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
In Markdown 1.0.0 and earlier. | ||
Version | ||
8. This line turns into a list item. | ||
Because a hard-wrapped line in the | ||
middle of a paragraph looked like a | ||
list item. | ||
Version 8. This line turns into a | ||
list item. Because a hard-wrapped | ||
line in the middle of a paragraph | ||
looked like a list item. | ||
|
||
Here's one with a bullet. | ||
* criminey. | ||
Here's one with a bullet. * | ||
criminey. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.