2024-03-12 15:23:08 +01:00

56 lines
1.1 KiB
Go

package ansi_test
import (
"testing"
"git.akyoto.dev/go/color"
"git.akyoto.dev/go/color/ansi"
)
func TestPrintRaw(t *testing.T) {
color.Terminal = false
testPrint()
testPrintf()
testPrintln()
}
func TestPrint(t *testing.T) {
color.Terminal = true
testPrint()
testPrintf()
testPrintln()
}
func testPrint() {
ansi.Black.Print("Black\n")
ansi.White.Print("White\n")
ansi.Red.Print("Red\n")
ansi.Green.Print("Green\n")
ansi.Blue.Print("Blue\n")
ansi.Yellow.Print("Yellow\n")
ansi.Magenta.Print("Magenta\n")
ansi.Cyan.Print("Cyan\n")
}
func testPrintf() {
ansi.Black.Printf("%s\n", "Black")
ansi.White.Printf("%s\n", "White")
ansi.Red.Printf("%s\n", "Red")
ansi.Green.Printf("%s\n", "Green")
ansi.Blue.Printf("%s\n", "Blue")
ansi.Yellow.Printf("%s\n", "Yellow")
ansi.Magenta.Printf("%s\n", "Magenta")
ansi.Cyan.Printf("%s\n", "Cyan")
}
func testPrintln() {
ansi.Black.Println("Black")
ansi.White.Println("White")
ansi.Red.Println("Red")
ansi.Green.Println("Green")
ansi.Blue.Println("Blue")
ansi.Yellow.Println("Yellow")
ansi.Magenta.Println("Magenta")
ansi.Cyan.Println("Cyan")
}