Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: check remained lines after all test cases #132

Merged
merged 1 commit into from
Sep 4, 2024
Merged
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
11 changes: 7 additions & 4 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ func (t *tester) Run() error {
}
}

// check do we have remained lines in result file
buf := make([]byte, 32)
if n, _ := t.resultFD.ReadAt(buf, int64(t.buf.Len())); n != 0 {
return errors.Trace(errors.Errorf("There is extra data at the end of the result file: %s", buf))
}

fmt.Printf("%s: ok! %d test cases passed, take time %v s\n", t.testFileName(), testCnt, time.Since(startTime).Seconds())

if xmlPath != "" {
Expand Down Expand Up @@ -784,13 +790,10 @@ func (t *tester) execute(query query) error {
if err != nil {
return errors.Trace(errors.Errorf("run \"%v\" at line %d err %v", query.Query, query.Line, err))
}

// clear expected errors after we execute the first query
t.expectedErrs = nil

if err != nil {
Copy link
Contributor Author

@Defined2014 Defined2014 Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dup check before.

return errors.Trace(errors.Errorf("run \"%v\" at line %d err %v", query.Query, query.Line, err))
}

if !record {
// check test result now
gotBuf := t.buf.Bytes()[offset:]
Expand Down
Loading