1
0
mirror of https://github.com/fatih/color.git synced 2024-11-24 08:02:14 +02:00

Improve tests.

This commit is contained in:
Fatih Arslan 2014-02-17 01:58:08 -08:00
parent 823f4ed20f
commit 0943b76fa0
2 changed files with 25 additions and 6 deletions

View File

@ -22,7 +22,7 @@ color.Blue.Print("Prints text in blue.")
// Chain SGR paramaters
color.Green.Add(color.Bold).Println("Green with bold")
color.Red.Add(color.BgWhite, color.Underline).Printf("Red with Black background and underscore: %s\n", "format too!")
color.Red.Add(color.BgWhite, color.Underline).Println("Red with Black background and underscore")
```
### Custom colors

View File

@ -7,17 +7,36 @@ import (
// The example from the standart library doesn't work unfortunaly.
func TestColor(t *testing.T) {
Cyan.Print("Prints text in cyan.")
Blue.Print("Prints text in blue.")
fmt.Printf("black")
New(BgBlack).Println(" ")
fmt.Printf("red\t")
New(BgRed).Println(" ")
fmt.Printf("green\t")
New(BgGreen).Println(" ")
fmt.Printf("yellow\t")
New(BgYellow).Println(" ")
fmt.Printf("blue\t")
New(BgBlue).Println(" ")
fmt.Printf("magenta\t")
New(BgMagenta).Println(" ")
fmt.Printf("cyan\t")
New(BgCyan).Println(" ")
fmt.Printf("white\t")
New(BgWhite).Println(" ")
fmt.Println("")
Cyan.Print("Prints text in cyan. ")
Blue.Print("Prints text in blue. ")
// Chain SGR paramaters
Green.Add(Bold).Println("Green with bold")
Red.Add(BgWhite, Underline).Printf("Red with White background and underscore: %s\n", "format too!")
Red.Add(BgWhite, Underline).Println("Red with White background and underscore")
// Create and reuse color objects
c := Cyan.Add(Underline)
c := Red.Add(Underline)
fmt.Println(c.params)
c.Println("Prints cyan text with an underline.")
c.Printf("Thir prints bold cyan %s\n", "too!.")
// Create custom color objects:
d := New(FgWhite, BgGreen)