-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test and fix for crash parsing regexp /0{0/
- Loading branch information
Showing
2 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
testsrc/org/mozilla/javascript/tests/NativeRegExpTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.javascript.tests; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.mozilla.javascript.Context; | ||
import org.mozilla.javascript.ContextAction; | ||
import org.mozilla.javascript.ScriptableObject; | ||
import org.mozilla.javascript.regexp.NativeRegExp; | ||
|
||
public class NativeRegExpTest extends TestCase { | ||
|
||
public void testOpenBrace() { | ||
final String script = "/0{0/"; | ||
final ContextAction action = new ContextAction() { | ||
public Object run(final Context _cx) { | ||
final ScriptableObject scope = _cx.initStandardObjects(); | ||
final Object result = _cx.evaluateString(scope, script, "test script", 0, null); | ||
assertEquals(script, Context.toString(result)); | ||
return null; | ||
} | ||
}; | ||
|
||
Utils.runWithAllOptimizationLevels(action); | ||
} | ||
} |