|
|
@ -74,6 +74,11 @@ func TestFirstLineShort(t *testing.T) {
|
|
|
|
assert.Equal(t, "first line", val)
|
|
|
|
assert.Equal(t, "first line", val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestFirstLineError(t *testing.T) {
|
|
|
|
|
|
|
|
_, err := FirstLine("/tmp/does-not-exist")
|
|
|
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestLastLine(t *testing.T) {
|
|
|
|
func TestLastLine(t *testing.T) {
|
|
|
|
filename, err := fs.TempFilenameWithText(text)
|
|
|
|
filename, err := fs.TempFilenameWithText(text)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Nil(t, err)
|
|
|
@ -113,3 +118,8 @@ func TestLastLineWithLastNewlineShort(t *testing.T) {
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Equal(t, "last line", val)
|
|
|
|
assert.Equal(t, "last line", val)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestLastLineError(t *testing.T) {
|
|
|
|
|
|
|
|
_, err := LastLine("/tmp/does-not-exist")
|
|
|
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
|
|
|
}
|
|
|
|