mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 18:57:17 -07:00
add simple tests for core swag color functions
add simple tests for each of the color functions in core swag
This commit is contained in:
parent
480f0daa8d
commit
2d9e74ea46
1 changed files with 59 additions and 0 deletions
59
core/swag_test.go
Normal file
59
core/swag_test.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package core
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestW(t *testing.T) {
|
||||
exp := "<3\033[0m"
|
||||
got := W("<", "3")
|
||||
if got != exp {
|
||||
t.Fatalf("expected '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBold(t *testing.T) {
|
||||
exp := "\033[1mgohpers\033[0m"
|
||||
got := Bold("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDim(t *testing.T) {
|
||||
exp := "\033[2mgohpers\033[0m"
|
||||
got := Dim("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRed(t *testing.T) {
|
||||
exp := "\033[31mgohpers\033[0m"
|
||||
got := Red("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGreen(t *testing.T) {
|
||||
exp := "\033[32mgohpers\033[0m"
|
||||
got := Green("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlue(t *testing.T) {
|
||||
exp := "\033[34mgohpers\033[0m"
|
||||
got := Blue("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestYellow(t *testing.T) {
|
||||
exp := "\033[33mgohpers\033[0m"
|
||||
got := Yellow("gohpers")
|
||||
if got != exp {
|
||||
t.Fatalf("expected path '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue