Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stmt/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ parse:
z, ok, _ := unquote(v.Name, true)
if v.Defined = ok || v.Quote == '?'; v.Defined {
b.r, b.rlen = v.Substitute(b.r, z, ok)
i-- // account for removal of the :
}
if b.Len != 0 {
v.I += b.Len + 1
Expand Down
10 changes: 10 additions & 0 deletions testcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"log"
"os"
"regexp"
"strings"
"time"

gexpect "github.com/google/goexpect"
Expand Down Expand Up @@ -127,9 +128,18 @@ func (test Test) do(ctx context.Context, binpath string, timeout time.Duration)
return err
}
for _, line := range bytes.Split(buf, []byte{'\n'}) {
// give time to usql to react to sent commands so statements are close to their results in output
// this helps link failures to the statement that caused them
time.Sleep(100 * time.Millisecond)
if err := exp.Send(string(line) + "\n"); err != nil {
return err
}
command := strings.TrimSpace(string(line))
if command == `\q` || command == `\quit` {
break
// don't send any lines after quit command e.g. trailing empty lines
// Send() fails if the command has stopped
}
}
select {
case <-ctx.Done():
Expand Down
Loading