forked from tdewolff/minify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminify_test.go
More file actions
33 lines (25 loc) · 1016 Bytes
/
Copy pathminify_test.go
File metadata and controls
33 lines (25 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package minify
import (
"testing"
"github.com/tdewolff/test"
)
func TestMinify(t *testing.T) {
css, err := CSS(`a { color: blue; }`)
test.Error(t, err)
test.String(t, css, `a{color:blue}`)
html, err := HTML(`<!doctype html><html><head><title>Title</title></head><body><p style="color: #ff0000;"> Text </p></body></html>`)
test.Error(t, err)
test.String(t, html, `<!doctype html><title>Title</title><p style=color:red>Text`)
svg, err := SVG(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100"><path d="M 0,0 L 10, 0 z" style="color: #00ff00;"/></svg>`)
test.Error(t, err)
test.String(t, svg, `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100"><path d="M0 0H10z" style="color:#0f0"/></svg>`)
js, err := JS(`var a = 5.0;`)
test.Error(t, err)
test.String(t, js, `var a=5`)
json, err := JSON(`{"key" : 5.00}`)
test.Error(t, err)
test.String(t, json, `{"key":5}`)
xml, err := XML(`<note> text </note>`)
test.Error(t, err)
test.String(t, xml, `<note>text</note>`)
}