Open
Conversation
630cc70 to
2480372
Compare
Author
|
Dear @boyan-soubachov , do you mind review this PR or give some suggestion? |
Contributor
|
Can you retest by redirecting to a file and see if you see control characters ? |
Author
|
I think yes. Please refer this unit test: assert/colorize_test.go#L31 func TestColorize_Message(t *testing.T) {
failureMessage := fmt.Sprintf("Not equal: \n"+
"expected: %s\n"+
"actual : %s%s", "expected", "actual", "diff")
fmt.Println(WrapColorize(t).Message(failureMessage))
} |
Contributor
I think that proves it fails - you can see the terminal escapes e.g. |
Closed
fredbi
added a commit
to fredbi/testify
that referenced
this pull request
Jan 12, 2026
This PR adds support for colorized output, with minimal extra dependencies. - Actual / Expected in equal colorized - Diff output is colorized It is enabled with the specific extra blank import: _ "github.com/go-openapi/testify/enable/colors/v2" When enabled, colorized output is: * enabled by go test flag -testify.colorize * or by environment variable TESTIFY_COLORIZE=true By default, colors are chose to be rendered on a dark terminal. You may use darker colors on a bright terminal with: * go test flag -testify.colorize -testify.theme=light * or by environment variable TESTIFY_THEME=light This work is inspired and adapts the following PRs: * github.com/stretchr#1467 * github.com/stretchr#1480 * github.com/stretchr#1232 * github.com/stretchr#994 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
5 tasks
fredbi
added a commit
to fredbi/testify
that referenced
this pull request
Jan 12, 2026
This PR adds support for colorized output, with minimal extra dependencies. - Actual / Expected in equal colorized - Diff output is colorized It is enabled with the specific extra blank import: _ "github.com/go-openapi/testify/enable/colors/v2" When enabled, colorized output is: * enabled by go test flag -testify.colorize * or by environment variable TESTIFY_COLORIZE=true By default, colors are chose to be rendered on a dark terminal. You may use darker colors on a bright terminal with: * go test flag -testify.colorize -testify.theme=light * or by environment variable TESTIFY_THEME=light This work is inspired and adapts the following PRs: * github.com/stretchr#1467 * github.com/stretchr#1480 * github.com/stretchr#1232 * github.com/stretchr#994 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi
added a commit
to fredbi/testify
that referenced
this pull request
Jan 12, 2026
This PR adds support for colorized output, with minimal extra dependencies. - Actual / Expected in equal colorized - Diff output is colorized It is enabled with the specific extra blank import: _ "github.com/go-openapi/testify/enable/colors/v2" When enabled, colorized output is: * enabled by go test flag -testify.colorized * or by environment variable TESTIFY_COLORIZED=true By default, colors are chose to be rendered on a dark terminal. You may use darker colors on a bright terminal with: * go test flag -testify.colorized -testify.theme=light * or by environment variable TESTIFY_THEME=light This work is inspired and adapts the following PRs: * github.com/stretchr#1467 * github.com/stretchr#1480 * github.com/stretchr#1232 * github.com/stretchr#994 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi
added a commit
to fredbi/testify
that referenced
this pull request
Jan 12, 2026
This PR adds support for colorized output, with minimal extra dependencies. - Actual / Expected in equal colorized - Diff output is colorized It is enabled with the specific extra blank import: _ "github.com/go-openapi/testify/enable/colors/v2" When enabled, colorized output is: * enabled by go test flag -testify.colorized * or by environment variable TESTIFY_COLORIZED=true By default, colors are chose to be rendered on a dark terminal. You may use darker colors on a bright terminal with: * go test flag -testify.colorized -testify.theme=light * or by environment variable TESTIFY_THEME=light This work is inspired and adapts the following PRs: * github.com/stretchr#1467 * github.com/stretchr#1480 * github.com/stretchr#1232 * github.com/stretchr#994 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi
added a commit
to go-openapi/testify
that referenced
this pull request
Jan 12, 2026
This PR adds support for colorized output, with minimal extra dependencies. - Actual / Expected in equal colorized - Diff output is colorized It is enabled with the specific extra blank import: _ "github.com/go-openapi/testify/enable/colors/v2" When enabled, colorized output is: * enabled by go test flag -testify.colorized * or by environment variable TESTIFY_COLORIZED=true By default, colors are chose to be rendered on a dark terminal. You may use darker colors on a bright terminal with: * go test flag -testify.colorized -testify.theme=light * or by environment variable TESTIFY_THEME=light This work is inspired and adapts the following PRs: * github.com/stretchr#1467 * github.com/stretchr#1480 * github.com/stretchr#1232 * github.com/stretchr#994 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Colorize "expected" and "actual"
Changes
Resolves #946
Motivation
@boyan-soubachov says "It's an interesting idea."
@mvdkleijn says "I like this idea."
Related issues
N/A
Screenshot
TestColorize
Equal
Same
EqualValues
EqualError