color_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package color
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestText(t *testing.T) {
  7. fmt.Println("*** colored text ***")
  8. fmt.Println(Black("black"))
  9. fmt.Println(Red("red"))
  10. fmt.Println(Green("green"))
  11. fmt.Println(Yellow("yellow"))
  12. fmt.Println(Blue("blue"))
  13. fmt.Println(Magenta("magenta"))
  14. fmt.Println(Cyan("cyan"))
  15. fmt.Println(White("white"))
  16. fmt.Println(Grey("grey"))
  17. }
  18. func TestBackground(t *testing.T) {
  19. fmt.Println("*** colored background ***")
  20. fmt.Println(BlackBg("black background", Wht))
  21. fmt.Println(RedBg("red background"))
  22. fmt.Println(GreenBg("green background"))
  23. fmt.Println(YellowBg("yellow background"))
  24. fmt.Println(BlueBg("blue background"))
  25. fmt.Println(MagentaBg("magenta background"))
  26. fmt.Println(CyanBg("cyan background"))
  27. fmt.Println(WhiteBg("white background"))
  28. }
  29. func TestEmphasis(t *testing.T) {
  30. fmt.Println("*** emphasis ***")
  31. fmt.Println(Bold("bold"))
  32. fmt.Println(Dim("dim"))
  33. fmt.Println(Italic("italic"))
  34. fmt.Println(Underline("underline"))
  35. fmt.Println(Inverse("inverse"))
  36. fmt.Println(Hidden("hidden"))
  37. fmt.Println(Strikeout("strikeout"))
  38. }
  39. func TestMixMatch(t *testing.T) {
  40. fmt.Println("*** mix and match ***")
  41. fmt.Println(Green("bold green with white background", B, WhtBg))
  42. fmt.Println(Red("underline red", U))
  43. fmt.Println(Yellow("dim yellow", D))
  44. fmt.Println(Cyan("inverse cyan", In))
  45. fmt.Println(Blue("bold underline dim blue", B, U, D))
  46. }