summaryrefslogtreecommitdiff
path: root/external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js
diff options
context:
space:
mode:
Diffstat (limited to 'external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js')
-rw-r--r--external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js
new file mode 100644
index 000000000..9bcde1cfa
--- /dev/null
+++ b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.10_RegExp_Objects/15.10.6_Properties_of_the_RegExp_Prototype_Object/15.10.6.2_RegExp.prototype.exec/S15.10.6.2_A3_T6.js
@@ -0,0 +1,39 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+* @name: S15.10.6.2_A3_T6;
+* @section: 15.10.6.2, 13.2;
+* @assertion: RegExp.prototype.exec behavior depends on global property.
+* If global is true and lastIndex not changed manually,
+* next exec calling start to match from position where current match finished;
+* @description: RegExp is /(\d+)/g and tested string is "123 456 789";
+*/
+
+__re = /(\d+)/g;
+
+__matched = [];
+
+__expected = ["123","456","789"];
+
+do{
+ __executed = __re.exec("123 456 789");
+ if (__executed !== null) {
+ __matched.push(__executed[0]);
+ } else {
+ break;
+ }
+}while(true);
+
+//CHECK#1
+if (__expected.length !== __matched.length) {
+ $ERROR('#1: __executed = /(\\d+)/g.exec("123 456 789"); __matched.length === ' + (__expected.length) + '.Actual: ' + (__matched.length));
+}
+
+//CHECK#2
+for(var index=0; index<__expected.length; index++) {
+ if (__expected[index] !== __matched[index]) {
+ $ERROR('#2: __executed = /(\\d+)/g.exec("123 456 789"); __matched[' + index + '] === ' + __expected[index] + '. Actual: ' + __matched[index]);
+ }
+}
+