✨ Only add newline to file when needed
This commit is contained in:
parent
2fc60c16c6
commit
5b8e4696ea
4 changed files with 82 additions and 5 deletions
|
|
@ -74,7 +74,7 @@ func (e Entry) MarshalText() ([]byte, error) {
|
|||
}
|
||||
ch := e.getFieldMarshalChan()
|
||||
buff := &bytes.Buffer{}
|
||||
buff.WriteString("\n@begin ")
|
||||
buff.WriteString("@begin ")
|
||||
buff.WriteString(e.Date.Format(DateFormat))
|
||||
buff.WriteString(" - ")
|
||||
buff.WriteString(e.Title)
|
||||
|
|
|
|||
|
|
@ -90,13 +90,13 @@ func getEntryMarshalTestRunner(title string, date time.Time, fields []Meta, firs
|
|||
if first == "" {
|
||||
return
|
||||
}
|
||||
os := string(o)
|
||||
if len(lines) == 0 {
|
||||
assert.Equal(t, "\n"+first, string(o))
|
||||
assert.Equal(t, first, os)
|
||||
return
|
||||
}
|
||||
|
||||
os := string(o)
|
||||
assert.Regexp(t, "^\n"+first, os)
|
||||
assert.Regexp(t, first, os)
|
||||
for _, line := range lines {
|
||||
assert.Regexp(t, "(?m)^"+line, os)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue