Skip to content

Commit

Permalink
test: prepare tests for new version of testify assert
Browse files Browse the repository at this point in the history
The new version will slightly change the formatting of the output,
regexp is changing because of this.
  • Loading branch information
xorcare committed Jan 26, 2024
1 parent 7db0927 commit 42e518b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func (t *T) Logf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
// Removed the trace, it contains line numbers and changes dynamically,
// it is not convenient to see in the examples.
re := regexp.MustCompile(`(?im)Error Trace:([\w\s:.]+)Error:`)
msg = re.ReplaceAllString(msg, "Error Trace:\n\tError:")
re := regexp.MustCompile(`(?im)^\t?Error\ Trace\:([\S\s\n]+)^\t?Error\:`)
msg = re.ReplaceAllString(msg, "\tError Trace:\n\tError:")

msg = strings.Replace(msg, "\t", "", -1)

Expand Down
4 changes: 2 additions & 2 deletions testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (m *bufferTB) Helper() {

func (m *bufferTB) Logf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
re := regexp.MustCompile(`(?im)Error Trace:([\w\s:.]+)Error:`)
msg = re.ReplaceAllString(msg, "Error Trace:\n\tError:")
re := regexp.MustCompile(`(?im)^\t?Error\ Trace\:([\S\s\n]+)^\t?Error\:`)
msg = re.ReplaceAllString(msg, "\tError Trace:\n\tError:")
m.logs = append(m.logs, msg)
}

Expand Down

0 comments on commit 42e518b

Please sign in to comment.