package credits import ( "amadan.net/oficina/estilo.git/theme" "github.com/carlosframework/rastrillo/ui" "regexp" "testing" ) // Mutation-checked: the former undefined --rst-border reference must fail. func TestCreditStylesUseDefinedTokens(t *testing.T) { definitions := map[string]bool{} styles := append(append([]byte{}, ui.TokensCSS()...), theme.CSS()...) for _, m := range regexp.MustCompile(`(--rst-[a-z0-9-]+)\s*:`).FindAllSubmatch(styles, -1) { definitions[string(m[1])] = true } references := regexp.MustCompile(`var\(\s*(--rst-[a-z0-9-]+)`).FindAllSubmatch(CSS(), -1) if len(references) == 0 { t.Fatal("credit token reference disappeared") } for _, m := range references { if !definitions[string(m[1])] { t.Fatal("credit stylesheet uses undefined token", string(m[1])) } } }