fortlit/main_test.go
Marvin Steadfast f3fecbbdc2
Some checks reported errors
continuous-integration/drone/tag Build was killed
fixes bug that doesnt output quote if less than 2 quotes for that time
2020-01-07 14:23:16 +01:00

49 lines
892 B
Go

package main
import (
"testing"
)
func TestDecorate(t *testing.T) {
tables := []struct {
q Quote
n string
}{
{
Quote{
"Max Mustermann",
"Testbook",
"This is a time!",
"time",
},
"\nThis is a \033[1;34mtime\033[0m!\n\n - Testbook, \033[1;36mMax Mustermann\033[0m\n",
},
}
for _, table := range tables {
r := table.q.decorate()
if r != table.n {
t.Errorf("string not is not \"%s\". got \"%s\".", table.n, r)
}
}
}
func TestGet(t *testing.T) {
tables := []struct {
m map[string][]Quote
q Quote
}{
{
map[string][]Quote{"00:00": {
Quote{"Max Mustermann", "Testbook", "This is a time!", "time"},
}},
Quote{"Max Mustermann", "Testbook", "This is a time!", "time"},
},
}
for _, table := range tables {
q := get(table.m, "00:00")
if q != table.q {
t.Errorf("quote \"%+v\" is not like \"%+v\"", q, table.q)
}
}
}