Keep selected framework theme drift guard with shared bytes
1 file changed,
+18
−1
internal/slidestest/vendored_test.go+18 −1
CI passed — run details
diff --git a/internal/slidestest/vendored_test.go b/internal/slidestest/vendored_test.go| index d08acbd..1aeb99f 100644 |
| --- a/internal/slidestest/vendored_test.go |
| +++ b/internal/slidestest/vendored_test.go |
| @@ -6,6 +6,7 @@ import ( |
| "path/filepath" |
| "testing" |
| + "amadan.net/oficina/estilo.git/theme" |
| "amadan.net/rastrillo/rastrillo/ui" |
| ) |
| @@ -42,7 +43,14 @@ func TestVendoredAssetsMatchTheLibrary(t *testing.T) { |
| if vendoredIsMine[name] { |
| continue |
| } |
| - vendored, err := os.ReadFile(filepath.Join("..", "slides", "static", name)) |
| + var vendored []byte |
| + var err error |
| + if name == "theme.css" { |
| + vendored = themeBody(theme.CSS()) |
| + lib = themeBody(lib) |
| + } else { |
| + vendored, err = os.ReadFile(filepath.Join("..", "slides", "static", name)) |
| + } |
| if err != nil { |
| t.Errorf("read vendored %s: %v", name, err) |
| continue |
| @@ -52,3 +60,12 @@ func TestVendoredAssetsMatchTheLibrary(t *testing.T) { |
| } |
| } |
| } |
| + |
| +func themeBody(css []byte) []byte { |
| + if bytes.HasPrefix(css, []byte("/*")) { |
| + if end := bytes.Index(css, []byte("*/")); end >= 0 { |
| + return css[end+2:] |
| + } |
| + } |
| + return css |
| +} |