| 1 |
package js |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/tdewolff/test" |
| 7 |
) |
| 8 |
|
| 9 |
func TestAsIdentifierName(t *testing.T) { |
| 10 |
test.That(t, !AsIdentifierName([]byte(""))) |
| 11 |
test.That(t, !AsIdentifierName([]byte("5"))) |
| 12 |
test.That(t, AsIdentifierName([]byte("ab"))) |
| 13 |
test.That(t, !AsIdentifierName([]byte("a="))) |
| 14 |
} |
| 15 |
|
| 16 |
func TestAsDecimalLiteral(t *testing.T) { |
| 17 |
test.That(t, !AsDecimalLiteral([]byte(""))) |
| 18 |
test.That(t, !AsDecimalLiteral([]byte("a"))) |
| 19 |
test.That(t, AsDecimalLiteral([]byte("12"))) |
| 20 |
test.That(t, AsDecimalLiteral([]byte("12.56"))) |
| 21 |
test.That(t, AsDecimalLiteral([]byte(".56"))) |
| 22 |
test.That(t, !AsDecimalLiteral([]byte(".56a"))) |
| 23 |
test.That(t, !AsDecimalLiteral([]byte("."))) |
| 24 |
test.That(t, AsDecimalLiteral([]byte("0"))) |
| 25 |
test.That(t, !AsDecimalLiteral([]byte("00"))) |
| 26 |
} |