2024-03-11 22:28:37 +00:00
|
|
|
package ansi_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"git.akyoto.dev/go/color"
|
|
|
|
"git.akyoto.dev/go/color/ansi"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPrintRaw(t *testing.T) {
|
|
|
|
color.Terminal = false
|
2024-03-12 14:23:08 +00:00
|
|
|
testPrint()
|
|
|
|
testPrintf()
|
|
|
|
testPrintln()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPrint(t *testing.T) {
|
|
|
|
color.Terminal = true
|
|
|
|
testPrint()
|
|
|
|
testPrintf()
|
|
|
|
testPrintln()
|
2024-03-11 22:28:37 +00:00
|
|
|
}
|
|
|
|
|
2024-03-12 14:23:08 +00:00
|
|
|
func testPrint() {
|
2024-03-11 22:28:37 +00:00
|
|
|
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")
|
2024-03-12 14:23:08 +00:00
|
|
|
}
|
2024-03-11 22:28:37 +00:00
|
|
|
|
2024-03-12 14:23:08 +00:00
|
|
|
func testPrintf() {
|
2024-03-11 22:28:37 +00:00
|
|
|
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")
|
2024-03-12 14:23:08 +00:00
|
|
|
}
|
2024-03-11 22:28:37 +00:00
|
|
|
|
2024-03-12 14:23:08 +00:00
|
|
|
func testPrintln() {
|
2024-03-11 22:28:37 +00:00
|
|
|
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")
|
|
|
|
}
|