color/Color_test.go
2024-03-12 15:23:08 +01:00

50 lines
1015 B
Go

package color_test
import (
"testing"
"git.akyoto.dev/go/color"
)
func TestPrint(t *testing.T) {
color.Terminal = true
color.RGB(1, 0, 0).Print("red\n")
color.RGB(0, 1, 0).Print("green\n")
color.RGB(0, 0, 1).Print("blue\n")
color.Terminal = false
color.RGB(1, 0, 0).Print("red\n")
color.RGB(0, 1, 0).Print("green\n")
color.RGB(0, 0, 1).Print("blue\n")
}
func TestPrintf(t *testing.T) {
color.Terminal = true
color.RGB(1, 0, 0).Printf("%s\n", "red")
color.RGB(0, 1, 0).Printf("%s\n", "green")
color.RGB(0, 0, 1).Printf("%s\n", "blue")
color.Terminal = false
color.RGB(1, 0, 0).Printf("%s\n", "red")
color.RGB(0, 1, 0).Printf("%s\n", "green")
color.RGB(0, 0, 1).Printf("%s\n", "blue")
}
func TestPrintln(t *testing.T) {
color.Terminal = true
color.RGB(1, 0, 0).Println("red")
color.RGB(0, 1, 0).Println("green")
color.RGB(0, 0, 1).Println("blue")
color.Terminal = false
color.RGB(1, 0, 0).Println("red")
color.RGB(0, 1, 0).Println("green")
color.RGB(0, 0, 1).Println("blue")
}