MCPcopy
hub / github.com/tdewolff/minify / TestSpecialTagClosing

Function TestSpecialTagClosing

html/html_test.go:431–447  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

429}
430
431func TestSpecialTagClosing(t *testing.T) {
432 m := minify.New()
433 m.AddFunc("text/html", Minify)
434 m.AddFunc("text/css", func(_ *minify.M, w io.Writer, r io.Reader, _ map[string]string) error {
435 b, err := io.ReadAll(r)
436 test.Error(t, err)
437 test.String(t, string(b), "</script>")
438 _, err = w.Write(b)
439 return err
440 })
441
442 html := `<style></script></style>`
443 r := bytes.NewBufferString(html)
444 w := &bytes.Buffer{}
445 err := Minify(m, w, r, nil)
446 test.Minify(t, html, err, w.String(), html)
447}
448
449func TestReaderErrors(t *testing.T) {
450 r := test.NewErrorReader(0)

Callers

nothing calls this directly

Calls 6

AddFuncMethod · 0.80
MinifyFunction · 0.70
MinifyMethod · 0.65
stringFunction · 0.50
StringMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…