@@ -109,7 +109,7 @@ func ColorText(color string) string {
case "INV":
result = append(result, 7)
default:
- fmt.Println("ColorText Unknown:", part)
+ panic(fmt.Sprintf("ColorText Unknown: [%s] in %s", part, color))
}
@@ -49,3 +49,13 @@ func TestColorText(t *testing.T) {
+
+func TestColorTextFail(t *testing.T) {
+ defer func() {
+ if r := recover(); r == nil {
+ t.Error("ColorText did not panic on invalid color.")
+ }
+ }()
+ ColorText("BRIGHT BANANA ON FISH")
+}