| 1 |
package css |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/tdewolff/test" |
| 7 |
) |
| 8 |
|
| 9 |
func TestIsIdent(t *testing.T) { |
| 10 |
test.That(t, IsIdent([]byte("color"))) |
| 11 |
test.That(t, !IsIdent([]byte("4.5"))) |
| 12 |
} |
| 13 |
|
| 14 |
func TestIsURLUnquoted(t *testing.T) { |
| 15 |
test.That(t, IsURLUnquoted([]byte("http://x"))) |
| 16 |
test.That(t, !IsURLUnquoted([]byte(")"))) |
| 17 |
} |
| 18 |
|
| 19 |
func TestHsl2Rgb(t *testing.T) { |
| 20 |
r, g, b := HSL2RGB(0.0, 1.0, 0.5) |
| 21 |
test.T(t, r, 1.0) |
| 22 |
test.T(t, g, 0.0) |
| 23 |
test.T(t, b, 0.0) |
| 24 |
|
| 25 |
r, g, b = HSL2RGB(1.0, 1.0, 0.5) |
| 26 |
test.T(t, r, 1.0) |
| 27 |
test.T(t, g, 0.0) |
| 28 |
test.T(t, b, 0.0) |
| 29 |
|
| 30 |
r, g, b = HSL2RGB(0.66, 0.0, 1.0) |
| 31 |
test.T(t, r, 1.0) |
| 32 |
test.T(t, g, 1.0) |
| 33 |
test.T(t, b, 1.0) |
| 34 |
} |