fix: no newline at end of file

main
Tran Hau 2021-01-12 01:37:11 +07:00
parent afcee321fa
commit 176e35a16e
4 changed files with 7 additions and 5 deletions

View File

@ -12,4 +12,4 @@
### Others ### Others
- chore: new build - chore: new build

View File

@ -22,4 +22,4 @@
- chore(gitlab): release on gitlab - chore(gitlab): release on gitlab
- unleash the dragon - unleash the dragon

View File

@ -4,10 +4,12 @@ import "strings"
func Generate(bases []Node) string { func Generate(bases []Node) string {
lines := make([]string, len(bases)) lines := make([]string, len(bases))
for i, base := range bases { for i, base := range bases {
lines[i] = base.String() lines[i] = base.String()
} }
return strings.Join(lines, string(NewlineToken)+string(NewlineToken)) result := strings.Join(lines, string(NewlineToken)+string(NewlineToken))
// Fix no newline at end of file
result += string(NewlineToken)
return result
} }

View File

@ -26,7 +26,7 @@ func TestGenerate(t *testing.T) {
text: "item 2", text: "item 2",
}, },
}, },
want: "# header\n\n- item 1\n\n- item 2", want: "# header\n\n- item 1\n\n- item 2\n",
}, },
} }