Skip to content

Commit

Permalink
Also normalize expect input, and add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Aug 30, 2023
1 parent 9b6c30f commit 502ea17
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ func (tt *TermTest) Expect(value string, opts ...SetExpectOpt) error {
}

func (tt *TermTest) expect(value, buffer string) (endPos int, rerr error) {
if tt.opts.NormalizedLineEnds {
tt.opts.Logger.Println("NormalizedLineEnds prior to expect")
value = NormalizeLineEnds(value)
}

tt.opts.Logger.Printf("expect: '%s', buffer: '%s'\n", value, strings.Trim(strings.TrimSpace(buffer), "\x00"))
defer func() {
tt.opts.Logger.Printf("Match: %v\n", endPos > 0)
Expand Down
1 change: 1 addition & 0 deletions outputproducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (o *outputProducer) appendBuffer(value []byte) error {
}

if o.opts.NormalizedLineEnds {
o.opts.Logger.Println("NormalizedLineEnds prior to appendBuffer")
output = NormalizeLineEndsB(output)
}

Expand Down
1 change: 1 addition & 0 deletions termtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ func (tt *TermTest) Send(value string) (rerr error) {
}

if tt.opts.NormalizedLineEnds {
tt.opts.Logger.Println("NormalizedLineEnds prior to Send")
value = NormalizeLineEnds(value)
}

Expand Down

0 comments on commit 502ea17

Please sign in to comment.