2024-03-05 17:47:02 +01:00
|
|
|
package color_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2025-02-25 16:37:15 +01:00
|
|
|
"git.urbach.dev/go/color"
|
2024-03-05 17:47:02 +01:00
|
|
|
)
|
|
|
|
|
2024-03-06 19:23:49 +01:00
|
|
|
func TestPrint(t *testing.T) {
|
2024-03-05 19:10:27 +01:00
|
|
|
color.Terminal = true
|
2024-03-06 19:23:49 +01:00
|
|
|
|
|
|
|
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")
|
2024-03-05 19:10:27 +01:00
|
|
|
}
|
|
|
|
|
2024-03-11 22:08:28 +01:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2024-03-06 19:23:49 +01:00
|
|
|
func TestPrintln(t *testing.T) {
|
2024-03-06 00:18:51 +01:00
|
|
|
color.Terminal = true
|
|
|
|
|
2024-03-06 19:23:49 +01:00
|
|
|
color.RGB(1, 0, 0).Println("red")
|
|
|
|
color.RGB(0, 1, 0).Println("green")
|
|
|
|
color.RGB(0, 0, 1).Println("blue")
|
2024-03-06 00:18:51 +01:00
|
|
|
|
2024-03-06 19:23:49 +01:00
|
|
|
color.Terminal = false
|
2024-03-06 00:18:51 +01:00
|
|
|
|
2024-03-06 19:23:49 +01:00
|
|
|
color.RGB(1, 0, 0).Println("red")
|
|
|
|
color.RGB(0, 1, 0).Println("green")
|
|
|
|
color.RGB(0, 0, 1).Println("blue")
|
2024-03-05 19:10:27 +01:00
|
|
|
}
|