oficina / estilo Public

Clone
git clone https://amadan.net/oficina/estilo

Plain git — no account needed to clone.

Download

Download this file

1package credits
2
3import (
4 "amadan.net/oficina/estilo.git/theme"
5 "github.com/carlosframework/rastrillo/ui"
6 "regexp"
7 "testing"
8)
9
10// Mutation-checked: the former undefined --rst-border reference must fail.
11func TestCreditStylesUseDefinedTokens(t *testing.T) {
12 definitions := map[string]bool{}
13 styles := append(append([]byte{}, ui.TokensCSS()...), theme.CSS()...)
14 for _, m := range regexp.MustCompile(`(--rst-[a-z0-9-]+)\s*:`).FindAllSubmatch(styles, -1) {
15 definitions[string(m[1])] = true
16 }
17 references := regexp.MustCompile(`var\(\s*(--rst-[a-z0-9-]+)`).FindAllSubmatch(CSS(), -1)
18 if len(references) == 0 {
19 t.Fatal("credit token reference disappeared")
20 }
21 for _, m := range references {
22 if !definitions[string(m[1])] {
23 t.Fatal("credit stylesheet uses undefined token", string(m[1]))
24 }
25 }
26}
27