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

Function TestHTMLKeepQuotes

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

Source from the content-addressed store, hash-verified

312}
313
314func TestHTMLKeepQuotes(t *testing.T) {
315 htmlTests := []struct {
316 html string
317 expected string
318 }{
319 {`<p attr="test">`, `<p attr="test">`},
320 {`<p attr='test'>`, `<p attr='test'>`},
321 {`<p attr=test>`, `<p attr=test>`},
322 {`<meta name='viewport' content='width=device-width, initial-scale=1'>`, `<meta name='viewport' content='width=device-width,initial-scale=1'>`},
323 }
324
325 m := minify.New()
326 htmlMinifier := &Minifier{KeepQuotes: true}
327 for _, tt := range htmlTests {
328 t.Run(tt.html, func(t *testing.T) {
329 r := bytes.NewBufferString(tt.html)
330 w := &bytes.Buffer{}
331 err := htmlMinifier.Minify(m, w, r, nil)
332 test.Minify(t, tt.html, err, w.String(), tt.expected)
333 })
334 }
335}
336
337func TestHTMLURL(t *testing.T) {
338 htmlTests := []struct {

Callers

nothing calls this directly

Calls 4

MinifyMethod · 0.95
RunMethod · 0.80
MinifyMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…