package game import "testing" func TestHighlightDestination(t *testing.T) { l := highlightLine("14番線 山手線 渋谷方面 → 南東", "渋谷", colGood, colDim) if len(l) != 3 || l[0].text != "14番線 山手線 " || l[1].text != "渋谷" || l[1].col != colGood || l[2].col != colDim { t.Fatalf("spans = %+v", l) } if l := highlightLine("渋谷 渋谷", "渋谷", colGood, colDim); len(l) != 3 || l[0].col != colGood || l[2].col != colGood { t.Fatalf("flera träffar: %+v", l) } if l := highlightLine("東京方面", "渋谷", colGood, colDim); len(l) != 1 || l[0].col != colDim { t.Fatalf("ingen träff: allt nedtonat, fick %+v", l) } }