예제 #1
0
func Test_SetBgColor(t *testing.T) {
	yellow := Colorize{Fg: ColorRed, Bg: ColorYellow}
	text := "Background text"

	expected := "\x1b[0;31m\x1b[43mBackground text\x1b[0m"
	assert.Equal(t, expected, yellow.Paint(text))

	yellow.SetBgColor(ColorBlack)
	assert.NotEqual(t, expected, yellow.Paint(text))
}
예제 #2
0
func Test_SetFgColor(t *testing.T) {
	red := Colorize{Fg: ColorRed}
	text := "Foreground text"

	expected := "\x1b[0;31mForeground text\x1b[0m"
	assert.Equal(t, expected, red.Paint(text))

	red.SetFgColor(ColorBlue)
	assert.NotEqual(t, expected, red.Paint(text))
}
예제 #3
0
func Test_NormalHightIntensity(t *testing.T) {
	ncolorize := Colorize{Fg: ColorBlack}
	hcolorize := Colorize{Fg: ColorBlack, Prop: Property{Fgi: true}}

	assert.NotEqual(t, ncolorize.Paint("intensity colorize"), hcolorize.Paint("intensity colorize"))
}