Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
add unit test for single line with LF
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Jan 2, 2019
1 parent ddd79c9 commit 3b5936a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions runtime/line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ func TestLineWriter(t *testing.T) {
}
}

func TestLineWriterSingle(t *testing.T) {
line := &Line{}
hook := &Hook{}
state := &State{}

hook.GotLine = func(_ *State, l *Line) error {
line = l
return nil
}
state.hook = hook
state.Step = &engine.Step{}
state.config = &engine.Spec{}

lw := newWriter(state)
lw.num = 5
lw.Write([]byte("foo\n"))

if line == nil {
t.Error("Expect LineFunc invoked")
}
if got, want := line.Message, "foo\n"; got != want {
t.Errorf("Got line %q, want %q", got, want)
}
if got, want := line.Number, 5; got != want {
t.Errorf("Got line %d, want %d", got, want)
}
}

func TestLineWriterMulti(t *testing.T) {
var lines []*Line
hook := &Hook{}
Expand Down

0 comments on commit 3b5936a

Please sign in to comment.