Skip to content

Commit

Permalink
fixes #206
Browse files Browse the repository at this point in the history
  • Loading branch information
gregpoirson committed Oct 17, 2023
1 parent c211ac1 commit 641fc85
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func readRaw(t *testing.T, r io.Reader) string {
return string(out)
}

func TestResetSecondFormat(t *testing.T) {
func TestIssue206_1(t *testing.T) {

var underline = New(Underline).Sprint

Expand All @@ -485,3 +485,20 @@ func TestResetSecondFormat(t *testing.T) {
t.Errorf("Expecting %v, got '%v'\n", expectedResult, result)
}
}

func TestIssue206_2(t *testing.T) {

var underline = New(Underline).Sprint
var bold = New(Bold).Sprint

var line = fmt.Sprintf("%s %s", GreenString(underline("underlined regular green")), RedString(bold("bold red")))

fmt.Println(line)

var result = fmt.Sprintf("%v", line)
const expectedResult = "underlined regular green bold red"

Check failure on line 499 in color_test.go

View workflow job for this annotation

GitHub Actions / Test & Build

string literal contains Unicode control characters, consider using escape sequences instead (ST1018)

if !bytes.Equal([]byte(result), []byte(expectedResult)) {
t.Errorf("Expecting %v, got '%v'\n", expectedResult, result)
}
}

0 comments on commit 641fc85

Please sign in to comment.