1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Fix broken (panicking) RegExp transformations

Transformations would panic on some edge (error) cases:

    \u0z
    \x_
This commit is contained in:
Robert Krimen
2012-12-28 15:50:37 -08:00
parent de3300c23b
commit 668d0fc6a7
4 changed files with 25 additions and 33 deletions

View File

@@ -58,6 +58,7 @@ func TestTransformRegExp(t *testing.T) {
Is(transformRegExp(`\\|'|\r|\n|\t|\u2028|\u2029`), `\\|'|\r|\n|\t|\x{2028}|\x{2029}`)
Is(transformRegExp(`\x`), `x`)
Is(transformRegExp(`\u0z01\x\undefined`), `u0z01xundefined`)
}
func TestIsValidRegExp(t *testing.T) {