aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/tdewolff/parse/css/util_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/tdewolff/parse/css/util_test.go')
-rw-r--r--vendor/github.com/tdewolff/parse/css/util_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/tdewolff/parse/css/util_test.go b/vendor/github.com/tdewolff/parse/css/util_test.go
new file mode 100644
index 0000000..9eb5aa9
--- /dev/null
+++ b/vendor/github.com/tdewolff/parse/css/util_test.go
@@ -0,0 +1,34 @@
+package css // import "github.com/tdewolff/parse/css"
+
+import (
+ "testing"
+
+ "github.com/tdewolff/test"
+)
+
+func TestIsIdent(t *testing.T) {
+ test.That(t, IsIdent([]byte("color")))
+ test.That(t, !IsIdent([]byte("4.5")))
+}
+
+func TestIsURLUnquoted(t *testing.T) {
+ test.That(t, IsURLUnquoted([]byte("http://x")))
+ test.That(t, !IsURLUnquoted([]byte(")")))
+}
+
+func TestHsl2Rgb(t *testing.T) {
+ r, g, b := HSL2RGB(0.0, 1.0, 0.5)
+ test.T(t, r, 1.0)
+ test.T(t, g, 0.0)
+ test.T(t, b, 0.0)
+
+ r, g, b = HSL2RGB(1.0, 1.0, 0.5)
+ test.T(t, r, 1.0)
+ test.T(t, g, 0.0)
+ test.T(t, b, 0.0)
+
+ r, g, b = HSL2RGB(0.66, 0.0, 1.0)
+ test.T(t, r, 1.0)
+ test.T(t, g, 1.0)
+ test.T(t, b, 1.0)
+}