-
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.
Fix issue #1041. Handles {0} quantifier with max of zero correctly.
- Loading branch information
1 parent
cb8d5f0
commit df023ed
Showing
2 changed files
with
31 additions
and
2 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
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,28 @@ | ||
/* 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 org.junit.Assert; | ||
import org.junit.Test; | ||
import org.mozilla.javascript.Context; | ||
import org.mozilla.javascript.ScriptableObject; | ||
|
||
public class Issue1041Test { | ||
@Test | ||
public void testQuantifierWithMax0() { | ||
Context cx = Context.enter(); | ||
try { | ||
ScriptableObject scope = cx.initStandardObjects(); | ||
Boolean result = | ||
(Boolean) cx.evaluateString(scope, "/ab{0}c/.test('abc')", "<eval>", 1, null); | ||
Assert.assertFalse(result); | ||
|
||
result = (Boolean) cx.evaluateString(scope, "/ab{0}c/.test('ac')", "<eval>", 1, null); | ||
Assert.assertTrue(result); | ||
} finally { | ||
Context.exit(); | ||
} | ||
} | ||
} |