How to use status method in lisa

Best Python code snippet using lisa_python

perlstress-001.js

Source:perlstress-001.js Github

copy

Full Screen

1/* ***** BEGIN LICENSE BLOCK *****2* Version: NPL 1.1/GPL 2.0/LGPL 2.13*4* The contents of this file are subject to the Netscape Public License5* Version 1.1 (the "License"); you may not use this file except in6* compliance with the License. You may obtain a copy of the License at7* http://www.mozilla.org/NPL/8*9* Software distributed under the License is distributed on an "AS IS" basis,10* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License11* for the specific language governing rights and limitations under the12* License.13*14* The Original Code is JavaScript Engine testing utilities.15*16* The Initial Developer of the Original Code is Netscape Communications Corp.17* Portions created by the Initial Developer are Copyright (C) 200218* the Initial Developer. All Rights Reserved.19*20* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com21*22* Alternatively, the contents of this file may be used under the terms of23* either the GNU General Public License Version 2 or later (the "GPL"), or24* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),25* in which case the provisions of the GPL or the LGPL are applicable instead26* of those above. If you wish to allow use of your version of this file only27* under the terms of either the GPL or the LGPL, and not to allow others to28* use your version of this file under the terms of the NPL, indicate your29* decision by deleting the provisions above and replace them with the notice30* and other provisions required by the GPL or the LGPL. If you do not delete31* the provisions above, a recipient may use your version of this file under32* the terms of any one of the NPL, the GPL or the LGPL.33*34* ***** END LICENSE BLOCK *****35*36*37* Date: 2002-07-0738* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.39* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.40*41* This test was created by running various patterns and strings through the42* Perl 5 RegExp engine. We saved the results below to test the JS engine.43*44* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented45* out such sections altogether, or modified them to fit what we expect from JS.46*47* EXAMPLES:48*49* - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used.50* See http://bugzilla.mozilla.org/show_bug.cgi?id=123437.51* By contrast, in Perl, unmatched captures hold the empty string.52* We have modified such sections accordingly. Example:53 pattern = /^([^a-z])|(\^)$/;54 string = '.';55 actualmatch = string.match(pattern);56 //expectedmatch = Array('.', '.', ''); <<<--- Perl57 expectedmatch = Array('.', '.', undefined); <<<--- JS58 addThis();59* - In JS, you can't refer to a capture before it's encountered & completed60*61* - Perl supports ] & ^] inside a [], ECMA does not62*63* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.64*65* - ECMA doesn't support (?imsx or (?-imsx66*67* - ECMA doesn't support (?(condition)68*69* - Perl has \Z has end-of-line, ECMA doesn't70*71* - In ECMA, ^ matches only the empty string before the first character72*73* - In ECMA, $ matches only the empty string at end of input (unless multiline)74*75* - ECMA spec says that each atom in a range must be a single character76*77* - ECMA doesn't support \A78*79* - ECMA doesn't have rules for [:80*81*/82//-----------------------------------------------------------------------------83var i = 0;84var bug = 85721;85var summary = 'Testing regular expression edge cases';86var cnSingleSpace = ' ';87var status = '';88var statusmessages = new Array();89var pattern = '';90var patterns = new Array();91var string = '';92var strings = new Array();93var actualmatch = '';94var actualmatches = new Array();95var expectedmatch = '';96var expectedmatches = new Array();97var cnLBOUND = 1;98var cnUBOUND = 1000;99status = inSection(1);100pattern = /abc/;101string = 'abc';102actualmatch = string.match(pattern);103expectedmatch = Array('abc');104addThis();105status = inSection(2);106pattern = /abc/;107string = 'xabcy';108actualmatch = string.match(pattern);109expectedmatch = Array('abc');110addThis();111status = inSection(3);112pattern = /abc/;113string = 'ababc';114actualmatch = string.match(pattern);115expectedmatch = Array('abc');116addThis();117status = inSection(4);118pattern = /ab*c/;119string = 'abc';120actualmatch = string.match(pattern);121expectedmatch = Array('abc');122addThis();123status = inSection(5);124pattern = /ab*bc/;125string = 'abc';126actualmatch = string.match(pattern);127expectedmatch = Array('abc');128addThis();129status = inSection(6);130pattern = /ab*bc/;131string = 'abbc';132actualmatch = string.match(pattern);133expectedmatch = Array('abbc');134addThis();135status = inSection(7);136pattern = /ab*bc/;137string = 'abbbbc';138actualmatch = string.match(pattern);139expectedmatch = Array('abbbbc');140addThis();141status = inSection(8);142pattern = /.{1}/;143string = 'abbbbc';144actualmatch = string.match(pattern);145expectedmatch = Array('a');146addThis();147status = inSection(9);148pattern = /.{3,4}/;149string = 'abbbbc';150actualmatch = string.match(pattern);151expectedmatch = Array('abbb');152addThis();153status = inSection(10);154pattern = /ab{0,}bc/;155string = 'abbbbc';156actualmatch = string.match(pattern);157expectedmatch = Array('abbbbc');158addThis();159status = inSection(11);160pattern = /ab+bc/;161string = 'abbc';162actualmatch = string.match(pattern);163expectedmatch = Array('abbc');164addThis();165status = inSection(12);166pattern = /ab+bc/;167string = 'abbbbc';168actualmatch = string.match(pattern);169expectedmatch = Array('abbbbc');170addThis();171status = inSection(13);172pattern = /ab{1,}bc/;173string = 'abbbbc';174actualmatch = string.match(pattern);175expectedmatch = Array('abbbbc');176addThis();177status = inSection(14);178pattern = /ab{1,3}bc/;179string = 'abbbbc';180actualmatch = string.match(pattern);181expectedmatch = Array('abbbbc');182addThis();183status = inSection(15);184pattern = /ab{3,4}bc/;185string = 'abbbbc';186actualmatch = string.match(pattern);187expectedmatch = Array('abbbbc');188addThis();189status = inSection(16);190pattern = /ab?bc/;191string = 'abbc';192actualmatch = string.match(pattern);193expectedmatch = Array('abbc');194addThis();195status = inSection(17);196pattern = /ab?bc/;197string = 'abc';198actualmatch = string.match(pattern);199expectedmatch = Array('abc');200addThis();201status = inSection(18);202pattern = /ab{0,1}bc/;203string = 'abc';204actualmatch = string.match(pattern);205expectedmatch = Array('abc');206addThis();207status = inSection(19);208pattern = /ab?c/;209string = 'abc';210actualmatch = string.match(pattern);211expectedmatch = Array('abc');212addThis();213status = inSection(20);214pattern = /ab{0,1}c/;215string = 'abc';216actualmatch = string.match(pattern);217expectedmatch = Array('abc');218addThis();219status = inSection(21);220pattern = /^abc$/;221string = 'abc';222actualmatch = string.match(pattern);223expectedmatch = Array('abc');224addThis();225status = inSection(22);226pattern = /^abc/;227string = 'abcc';228actualmatch = string.match(pattern);229expectedmatch = Array('abc');230addThis();231status = inSection(23);232pattern = /abc$/;233string = 'aabc';234actualmatch = string.match(pattern);235expectedmatch = Array('abc');236addThis();237status = inSection(24);238pattern = /^/;239string = 'abc';240actualmatch = string.match(pattern);241expectedmatch = Array('');242addThis();243status = inSection(25);244pattern = /$/;245string = 'abc';246actualmatch = string.match(pattern);247expectedmatch = Array('');248addThis();249status = inSection(26);250pattern = /a.c/;251string = 'abc';252actualmatch = string.match(pattern);253expectedmatch = Array('abc');254addThis();255status = inSection(27);256pattern = /a.c/;257string = 'axc';258actualmatch = string.match(pattern);259expectedmatch = Array('axc');260addThis();261status = inSection(28);262pattern = /a.*c/;263string = 'axyzc';264actualmatch = string.match(pattern);265expectedmatch = Array('axyzc');266addThis();267status = inSection(29);268pattern = /a[bc]d/;269string = 'abd';270actualmatch = string.match(pattern);271expectedmatch = Array('abd');272addThis();273status = inSection(30);274pattern = /a[b-d]e/;275string = 'ace';276actualmatch = string.match(pattern);277expectedmatch = Array('ace');278addThis();279status = inSection(31);280pattern = /a[b-d]/;281string = 'aac';282actualmatch = string.match(pattern);283expectedmatch = Array('ac');284addThis();285status = inSection(32);286pattern = /a[-b]/;287string = 'a-';288actualmatch = string.match(pattern);289expectedmatch = Array('a-');290addThis();291status = inSection(33);292pattern = /a[b-]/;293string = 'a-';294actualmatch = string.match(pattern);295expectedmatch = Array('a-');296addThis();297status = inSection(34);298pattern = /a]/;299string = 'a]';300actualmatch = string.match(pattern);301expectedmatch = Array('a]');302addThis();303/* Perl supports ] & ^] inside a [], ECMA does not304pattern = /a[]]b/;305status = inSection(35);306string = 'a]b';307actualmatch = string.match(pattern);308expectedmatch = Array('a]b');309addThis();310*/311status = inSection(36);312pattern = /a[^bc]d/;313string = 'aed';314actualmatch = string.match(pattern);315expectedmatch = Array('aed');316addThis();317status = inSection(37);318pattern = /a[^-b]c/;319string = 'adc';320actualmatch = string.match(pattern);321expectedmatch = Array('adc');322addThis();323/* Perl supports ] & ^] inside a [], ECMA does not324status = inSection(38);325pattern = /a[^]b]c/;326string = 'adc';327actualmatch = string.match(pattern);328expectedmatch = Array('adc');329addThis();330*/331status = inSection(39);332pattern = /\ba\b/;333string = 'a-';334actualmatch = string.match(pattern);335expectedmatch = Array('a');336addThis();337status = inSection(40);338pattern = /\ba\b/;339string = '-a';340actualmatch = string.match(pattern);341expectedmatch = Array('a');342addThis();343status = inSection(41);344pattern = /\ba\b/;345string = '-a-';346actualmatch = string.match(pattern);347expectedmatch = Array('a');348addThis();349status = inSection(42);350pattern = /\By\b/;351string = 'xy';352actualmatch = string.match(pattern);353expectedmatch = Array('y');354addThis();355status = inSection(43);356pattern = /\by\B/;357string = 'yz';358actualmatch = string.match(pattern);359expectedmatch = Array('y');360addThis();361status = inSection(44);362pattern = /\By\B/;363string = 'xyz';364actualmatch = string.match(pattern);365expectedmatch = Array('y');366addThis();367status = inSection(45);368pattern = /\w/;369string = 'a';370actualmatch = string.match(pattern);371expectedmatch = Array('a');372addThis();373status = inSection(46);374pattern = /\W/;375string = '-';376actualmatch = string.match(pattern);377expectedmatch = Array('-');378addThis();379status = inSection(47);380pattern = /a\Sb/;381string = 'a-b';382actualmatch = string.match(pattern);383expectedmatch = Array('a-b');384addThis();385status = inSection(48);386pattern = /\d/;387string = '1';388actualmatch = string.match(pattern);389expectedmatch = Array('1');390addThis();391status = inSection(49);392pattern = /\D/;393string = '-';394actualmatch = string.match(pattern);395expectedmatch = Array('-');396addThis();397status = inSection(50);398pattern = /[\w]/;399string = 'a';400actualmatch = string.match(pattern);401expectedmatch = Array('a');402addThis();403status = inSection(51);404pattern = /[\W]/;405string = '-';406actualmatch = string.match(pattern);407expectedmatch = Array('-');408addThis();409status = inSection(52);410pattern = /a[\S]b/;411string = 'a-b';412actualmatch = string.match(pattern);413expectedmatch = Array('a-b');414addThis();415status = inSection(53);416pattern = /[\d]/;417string = '1';418actualmatch = string.match(pattern);419expectedmatch = Array('1');420addThis();421status = inSection(54);422pattern = /[\D]/;423string = '-';424actualmatch = string.match(pattern);425expectedmatch = Array('-');426addThis();427status = inSection(55);428pattern = /ab|cd/;429string = 'abc';430actualmatch = string.match(pattern);431expectedmatch = Array('ab');432addThis();433status = inSection(56);434pattern = /ab|cd/;435string = 'abcd';436actualmatch = string.match(pattern);437expectedmatch = Array('ab');438addThis();439status = inSection(57);440pattern = /()ef/;441string = 'def';442actualmatch = string.match(pattern);443expectedmatch = Array('ef', '');444addThis();445status = inSection(58);446pattern = /a\(b/;447string = 'a(b';448actualmatch = string.match(pattern);449expectedmatch = Array('a(b');450addThis();451status = inSection(59);452pattern = /a\(*b/;453string = 'ab';454actualmatch = string.match(pattern);455expectedmatch = Array('ab');456addThis();457status = inSection(60);458pattern = /a\(*b/;459string = 'a((b';460actualmatch = string.match(pattern);461expectedmatch = Array('a((b');462addThis();463status = inSection(61);464pattern = /a\\b/;465string = 'a\\b';466actualmatch = string.match(pattern);467expectedmatch = Array('a\\b');468addThis();469status = inSection(62);470pattern = /((a))/;471string = 'abc';472actualmatch = string.match(pattern);473expectedmatch = Array('a', 'a', 'a');474addThis();475status = inSection(63);476pattern = /(a)b(c)/;477string = 'abc';478actualmatch = string.match(pattern);479expectedmatch = Array('abc', 'a', 'c');480addThis();481status = inSection(64);482pattern = /a+b+c/;483string = 'aabbabc';484actualmatch = string.match(pattern);485expectedmatch = Array('abc');486addThis();487status = inSection(65);488pattern = /a{1,}b{1,}c/;489string = 'aabbabc';490actualmatch = string.match(pattern);491expectedmatch = Array('abc');492addThis();493status = inSection(66);494pattern = /a.+?c/;495string = 'abcabc';496actualmatch = string.match(pattern);497expectedmatch = Array('abc');498addThis();499status = inSection(67);500pattern = /(a+|b)*/;501string = 'ab';502actualmatch = string.match(pattern);503expectedmatch = Array('ab', 'b');504addThis();505status = inSection(68);506pattern = /(a+|b){0,}/;507string = 'ab';508actualmatch = string.match(pattern);509expectedmatch = Array('ab', 'b');510addThis();511status = inSection(69);512pattern = /(a+|b)+/;513string = 'ab';514actualmatch = string.match(pattern);515expectedmatch = Array('ab', 'b');516addThis();517status = inSection(70);518pattern = /(a+|b){1,}/;519string = 'ab';520actualmatch = string.match(pattern);521expectedmatch = Array('ab', 'b');522addThis();523status = inSection(71);524pattern = /(a+|b)?/;525string = 'ab';526actualmatch = string.match(pattern);527expectedmatch = Array('a', 'a');528addThis();529status = inSection(72);530pattern = /(a+|b){0,1}/;531string = 'ab';532actualmatch = string.match(pattern);533expectedmatch = Array('a', 'a');534addThis();535status = inSection(73);536pattern = /[^ab]*/;537string = 'cde';538actualmatch = string.match(pattern);539expectedmatch = Array('cde');540addThis();541status = inSection(74);542pattern = /([abc])*d/;543string = 'abbbcd';544actualmatch = string.match(pattern);545expectedmatch = Array('abbbcd', 'c');546addThis();547status = inSection(75);548pattern = /([abc])*bcd/;549string = 'abcd';550actualmatch = string.match(pattern);551expectedmatch = Array('abcd', 'a');552addThis();553status = inSection(76);554pattern = /a|b|c|d|e/;555string = 'e';556actualmatch = string.match(pattern);557expectedmatch = Array('e');558addThis();559status = inSection(77);560pattern = /(a|b|c|d|e)f/;561string = 'ef';562actualmatch = string.match(pattern);563expectedmatch = Array('ef', 'e');564addThis();565status = inSection(78);566pattern = /abcd*efg/;567string = 'abcdefg';568actualmatch = string.match(pattern);569expectedmatch = Array('abcdefg');570addThis();571status = inSection(79);572pattern = /ab*/;573string = 'xabyabbbz';574actualmatch = string.match(pattern);575expectedmatch = Array('ab');576addThis();577status = inSection(80);578pattern = /ab*/;579string = 'xayabbbz';580actualmatch = string.match(pattern);581expectedmatch = Array('a');582addThis();583status = inSection(81);584pattern = /(ab|cd)e/;585string = 'abcde';586actualmatch = string.match(pattern);587expectedmatch = Array('cde', 'cd');588addThis();589status = inSection(82);590pattern = /[abhgefdc]ij/;591string = 'hij';592actualmatch = string.match(pattern);593expectedmatch = Array('hij');594addThis();595status = inSection(83);596pattern = /(abc|)ef/;597string = 'abcdef';598actualmatch = string.match(pattern);599expectedmatch = Array('ef', '');600addThis();601status = inSection(84);602pattern = /(a|b)c*d/;603string = 'abcd';604actualmatch = string.match(pattern);605expectedmatch = Array('bcd', 'b');606addThis();607status = inSection(85);608pattern = /(ab|ab*)bc/;609string = 'abc';610actualmatch = string.match(pattern);611expectedmatch = Array('abc', 'a');612addThis();613status = inSection(86);614pattern = /a([bc]*)c*/;615string = 'abc';616actualmatch = string.match(pattern);617expectedmatch = Array('abc', 'bc');618addThis();619status = inSection(87);620pattern = /a([bc]*)(c*d)/;621string = 'abcd';622actualmatch = string.match(pattern);623expectedmatch = Array('abcd', 'bc', 'd');624addThis();625status = inSection(88);626pattern = /a([bc]+)(c*d)/;627string = 'abcd';628actualmatch = string.match(pattern);629expectedmatch = Array('abcd', 'bc', 'd');630addThis();631status = inSection(89);632pattern = /a([bc]*)(c+d)/;633string = 'abcd';634actualmatch = string.match(pattern);635expectedmatch = Array('abcd', 'b', 'cd');636addThis();637status = inSection(90);638pattern = /a[bcd]*dcdcde/;639string = 'adcdcde';640actualmatch = string.match(pattern);641expectedmatch = Array('adcdcde');642addThis();643status = inSection(91);644pattern = /(ab|a)b*c/;645string = 'abc';646actualmatch = string.match(pattern);647expectedmatch = Array('abc', 'ab');648addThis();649status = inSection(92);650pattern = /((a)(b)c)(d)/;651string = 'abcd';652actualmatch = string.match(pattern);653expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd');654addThis();655status = inSection(93);656pattern = /[a-zA-Z_][a-zA-Z0-9_]*/;657string = 'alpha';658actualmatch = string.match(pattern);659expectedmatch = Array('alpha');660addThis();661status = inSection(94);662pattern = /^a(bc+|b[eh])g|.h$/;663string = 'abh';664actualmatch = string.match(pattern);665expectedmatch = Array('bh', undefined);666addThis();667status = inSection(95);668pattern = /(bc+d$|ef*g.|h?i(j|k))/;669string = 'effgz';670actualmatch = string.match(pattern);671expectedmatch = Array('effgz', 'effgz', undefined);672addThis();673status = inSection(96);674pattern = /(bc+d$|ef*g.|h?i(j|k))/;675string = 'ij';676actualmatch = string.match(pattern);677expectedmatch = Array('ij', 'ij', 'j');678addThis();679status = inSection(97);680pattern = /(bc+d$|ef*g.|h?i(j|k))/;681string = 'reffgz';682actualmatch = string.match(pattern);683expectedmatch = Array('effgz', 'effgz', undefined);684addThis();685status = inSection(98);686pattern = /((((((((((a))))))))))/;687string = 'a';688actualmatch = string.match(pattern);689expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');690addThis();691status = inSection(99);692pattern = /((((((((((a))))))))))\10/;693string = 'aa';694actualmatch = string.match(pattern);695expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');696addThis();697status = inSection(100);698pattern = /((((((((((a))))))))))/;699string = 'a!';700actualmatch = string.match(pattern);701expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');702addThis();703status = inSection(101);704pattern = /(((((((((a)))))))))/;705string = 'a';706actualmatch = string.match(pattern);707expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a');708addThis();709status = inSection(102);710pattern = /(.*)c(.*)/;711string = 'abcde';712actualmatch = string.match(pattern);713expectedmatch = Array('abcde', 'ab', 'de');714addThis();715status = inSection(103);716pattern = /abcd/;717string = 'abcd';718actualmatch = string.match(pattern);719expectedmatch = Array('abcd');720addThis();721status = inSection(104);722pattern = /a(bc)d/;723string = 'abcd';724actualmatch = string.match(pattern);725expectedmatch = Array('abcd', 'bc');726addThis();727status = inSection(105);728pattern = /a[-]?c/;729string = 'ac';730actualmatch = string.match(pattern);731expectedmatch = Array('ac');732addThis();733status = inSection(106);734pattern = /(abc)\1/;735string = 'abcabc';736actualmatch = string.match(pattern);737expectedmatch = Array('abcabc', 'abc');738addThis();739status = inSection(107);740pattern = /([a-c]*)\1/;741string = 'abcabc';742actualmatch = string.match(pattern);743expectedmatch = Array('abcabc', 'abc');744addThis();745status = inSection(108);746pattern = /(a)|\1/;747string = 'a';748actualmatch = string.match(pattern);749expectedmatch = Array('a', 'a');750addThis();751status = inSection(109);752pattern = /(([a-c])b*?\2)*/;753string = 'ababbbcbc';754actualmatch = string.match(pattern);755expectedmatch = Array('ababb', 'bb', 'b');756addThis();757status = inSection(110);758pattern = /(([a-c])b*?\2){3}/;759string = 'ababbbcbc';760actualmatch = string.match(pattern);761expectedmatch = Array('ababbbcbc', 'cbc', 'c');762addThis();763/* Can't refer to a capture before it's encountered & completed764status = inSection(111);765pattern = /((\3|b)\2(a)x)+/;766string = 'aaaxabaxbaaxbbax';767actualmatch = string.match(pattern);768expectedmatch = Array('bbax', 'bbax', 'b', 'a');769addThis();770status = inSection(112);771pattern = /((\3|b)\2(a)){2,}/;772string = 'bbaababbabaaaaabbaaaabba';773actualmatch = string.match(pattern);774expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a');775addThis();776*/777status = inSection(113);778pattern = /abc/i;779string = 'ABC';780actualmatch = string.match(pattern);781expectedmatch = Array('ABC');782addThis();783status = inSection(114);784pattern = /abc/i;785string = 'XABCY';786actualmatch = string.match(pattern);787expectedmatch = Array('ABC');788addThis();789status = inSection(115);790pattern = /abc/i;791string = 'ABABC';792actualmatch = string.match(pattern);793expectedmatch = Array('ABC');794addThis();795status = inSection(116);796pattern = /ab*c/i;797string = 'ABC';798actualmatch = string.match(pattern);799expectedmatch = Array('ABC');800addThis();801status = inSection(117);802pattern = /ab*bc/i;803string = 'ABC';804actualmatch = string.match(pattern);805expectedmatch = Array('ABC');806addThis();807status = inSection(118);808pattern = /ab*bc/i;809string = 'ABBC';810actualmatch = string.match(pattern);811expectedmatch = Array('ABBC');812addThis();813status = inSection(119);814pattern = /ab*?bc/i;815string = 'ABBBBC';816actualmatch = string.match(pattern);817expectedmatch = Array('ABBBBC');818addThis();819status = inSection(120);820pattern = /ab{0,}?bc/i;821string = 'ABBBBC';822actualmatch = string.match(pattern);823expectedmatch = Array('ABBBBC');824addThis();825status = inSection(121);826pattern = /ab+?bc/i;827string = 'ABBC';828actualmatch = string.match(pattern);829expectedmatch = Array('ABBC');830addThis();831status = inSection(122);832pattern = /ab+bc/i;833string = 'ABBBBC';834actualmatch = string.match(pattern);835expectedmatch = Array('ABBBBC');836addThis();837status = inSection(123);838pattern = /ab{1,}?bc/i;839string = 'ABBBBC';840actualmatch = string.match(pattern);841expectedmatch = Array('ABBBBC');842addThis();843status = inSection(124);844pattern = /ab{1,3}?bc/i;845string = 'ABBBBC';846actualmatch = string.match(pattern);847expectedmatch = Array('ABBBBC');848addThis();849status = inSection(125);850pattern = /ab{3,4}?bc/i;851string = 'ABBBBC';852actualmatch = string.match(pattern);853expectedmatch = Array('ABBBBC');854addThis();855status = inSection(126);856pattern = /ab??bc/i;857string = 'ABBC';858actualmatch = string.match(pattern);859expectedmatch = Array('ABBC');860addThis();861status = inSection(127);862pattern = /ab??bc/i;863string = 'ABC';864actualmatch = string.match(pattern);865expectedmatch = Array('ABC');866addThis();867status = inSection(128);868pattern = /ab{0,1}?bc/i;869string = 'ABC';870actualmatch = string.match(pattern);871expectedmatch = Array('ABC');872addThis();873status = inSection(129);874pattern = /ab??c/i;875string = 'ABC';876actualmatch = string.match(pattern);877expectedmatch = Array('ABC');878addThis();879status = inSection(130);880pattern = /ab{0,1}?c/i;881string = 'ABC';882actualmatch = string.match(pattern);883expectedmatch = Array('ABC');884addThis();885status = inSection(131);886pattern = /^abc$/i;887string = 'ABC';888actualmatch = string.match(pattern);889expectedmatch = Array('ABC');890addThis();891status = inSection(132);892pattern = /^abc/i;893string = 'ABCC';894actualmatch = string.match(pattern);895expectedmatch = Array('ABC');896addThis();897status = inSection(133);898pattern = /abc$/i;899string = 'AABC';900actualmatch = string.match(pattern);901expectedmatch = Array('ABC');902addThis();903status = inSection(134);904pattern = /^/i;905string = 'ABC';906actualmatch = string.match(pattern);907expectedmatch = Array('');908addThis();909status = inSection(135);910pattern = /$/i;911string = 'ABC';912actualmatch = string.match(pattern);913expectedmatch = Array('');914addThis();915status = inSection(136);916pattern = /a.c/i;917string = 'ABC';918actualmatch = string.match(pattern);919expectedmatch = Array('ABC');920addThis();921status = inSection(137);922pattern = /a.c/i;923string = 'AXC';924actualmatch = string.match(pattern);925expectedmatch = Array('AXC');926addThis();927status = inSection(138);928pattern = /a.*?c/i;929string = 'AXYZC';930actualmatch = string.match(pattern);931expectedmatch = Array('AXYZC');932addThis();933status = inSection(139);934pattern = /a[bc]d/i;935string = 'ABD';936actualmatch = string.match(pattern);937expectedmatch = Array('ABD');938addThis();939status = inSection(140);940pattern = /a[b-d]e/i;941string = 'ACE';942actualmatch = string.match(pattern);943expectedmatch = Array('ACE');944addThis();945status = inSection(141);946pattern = /a[b-d]/i;947string = 'AAC';948actualmatch = string.match(pattern);949expectedmatch = Array('AC');950addThis();951status = inSection(142);952pattern = /a[-b]/i;953string = 'A-';954actualmatch = string.match(pattern);955expectedmatch = Array('A-');956addThis();957status = inSection(143);958pattern = /a[b-]/i;959string = 'A-';960actualmatch = string.match(pattern);961expectedmatch = Array('A-');962addThis();963status = inSection(144);964pattern = /a]/i;965string = 'A]';966actualmatch = string.match(pattern);967expectedmatch = Array('A]');968addThis();969/* Perl supports ] & ^] inside a [], ECMA does not970status = inSection(145);971pattern = /a[]]b/i;972string = 'A]B';973actualmatch = string.match(pattern);974expectedmatch = Array('A]B');975addThis();976*/977status = inSection(146);978pattern = /a[^bc]d/i;979string = 'AED';980actualmatch = string.match(pattern);981expectedmatch = Array('AED');982addThis();983status = inSection(147);984pattern = /a[^-b]c/i;985string = 'ADC';986actualmatch = string.match(pattern);987expectedmatch = Array('ADC');988addThis();989/* Perl supports ] & ^] inside a [], ECMA does not990status = inSection(148);991pattern = /a[^]b]c/i;992string = 'ADC';993actualmatch = string.match(pattern);994expectedmatch = Array('ADC');995addThis();996*/997status = inSection(149);998pattern = /ab|cd/i;999string = 'ABC';1000actualmatch = string.match(pattern);1001expectedmatch = Array('AB');1002addThis();1003status = inSection(150);1004pattern = /ab|cd/i;1005string = 'ABCD';1006actualmatch = string.match(pattern);1007expectedmatch = Array('AB');1008addThis();1009status = inSection(151);1010pattern = /()ef/i;1011string = 'DEF';1012actualmatch = string.match(pattern);1013expectedmatch = Array('EF', '');1014addThis();1015status = inSection(152);1016pattern = /a\(b/i;1017string = 'A(B';1018actualmatch = string.match(pattern);1019expectedmatch = Array('A(B');1020addThis();1021status = inSection(153);1022pattern = /a\(*b/i;1023string = 'AB';1024actualmatch = string.match(pattern);1025expectedmatch = Array('AB');1026addThis();1027status = inSection(154);1028pattern = /a\(*b/i;1029string = 'A((B';1030actualmatch = string.match(pattern);1031expectedmatch = Array('A((B');1032addThis();1033status = inSection(155);1034pattern = /a\\b/i;1035string = 'A\\B';1036actualmatch = string.match(pattern);1037expectedmatch = Array('A\\B');1038addThis();1039status = inSection(156);1040pattern = /((a))/i;1041string = 'ABC';1042actualmatch = string.match(pattern);1043expectedmatch = Array('A', 'A', 'A');1044addThis();1045status = inSection(157);1046pattern = /(a)b(c)/i;1047string = 'ABC';1048actualmatch = string.match(pattern);1049expectedmatch = Array('ABC', 'A', 'C');1050addThis();1051status = inSection(158);1052pattern = /a+b+c/i;1053string = 'AABBABC';1054actualmatch = string.match(pattern);1055expectedmatch = Array('ABC');1056addThis();1057status = inSection(159);1058pattern = /a{1,}b{1,}c/i;1059string = 'AABBABC';1060actualmatch = string.match(pattern);1061expectedmatch = Array('ABC');1062addThis();1063status = inSection(160);1064pattern = /a.+?c/i;1065string = 'ABCABC';1066actualmatch = string.match(pattern);1067expectedmatch = Array('ABC');1068addThis();1069status = inSection(161);1070pattern = /a.*?c/i;1071string = 'ABCABC';1072actualmatch = string.match(pattern);1073expectedmatch = Array('ABC');1074addThis();1075status = inSection(162);1076pattern = /a.{0,5}?c/i;1077string = 'ABCABC';1078actualmatch = string.match(pattern);1079expectedmatch = Array('ABC');1080addThis();1081status = inSection(163);1082pattern = /(a+|b)*/i;1083string = 'AB';1084actualmatch = string.match(pattern);1085expectedmatch = Array('AB', 'B');1086addThis();1087status = inSection(164);1088pattern = /(a+|b){0,}/i;1089string = 'AB';1090actualmatch = string.match(pattern);1091expectedmatch = Array('AB', 'B');1092addThis();1093status = inSection(165);1094pattern = /(a+|b)+/i;1095string = 'AB';1096actualmatch = string.match(pattern);1097expectedmatch = Array('AB', 'B');1098addThis();1099status = inSection(166);1100pattern = /(a+|b){1,}/i;1101string = 'AB';1102actualmatch = string.match(pattern);1103expectedmatch = Array('AB', 'B');1104addThis();1105status = inSection(167);1106pattern = /(a+|b)?/i;1107string = 'AB';1108actualmatch = string.match(pattern);1109expectedmatch = Array('A', 'A');1110addThis();1111status = inSection(168);1112pattern = /(a+|b){0,1}/i;1113string = 'AB';1114actualmatch = string.match(pattern);1115expectedmatch = Array('A', 'A');1116addThis();1117status = inSection(169);1118pattern = /(a+|b){0,1}?/i;1119string = 'AB';1120actualmatch = string.match(pattern);1121expectedmatch = Array('', undefined);1122addThis();1123status = inSection(170);1124pattern = /[^ab]*/i;1125string = 'CDE';1126actualmatch = string.match(pattern);1127expectedmatch = Array('CDE');1128addThis();1129status = inSection(171);1130pattern = /([abc])*d/i;1131string = 'ABBBCD';1132actualmatch = string.match(pattern);1133expectedmatch = Array('ABBBCD', 'C');1134addThis();1135status = inSection(172);1136pattern = /([abc])*bcd/i;1137string = 'ABCD';1138actualmatch = string.match(pattern);1139expectedmatch = Array('ABCD', 'A');1140addThis();1141status = inSection(173);1142pattern = /a|b|c|d|e/i;1143string = 'E';1144actualmatch = string.match(pattern);1145expectedmatch = Array('E');1146addThis();1147status = inSection(174);1148pattern = /(a|b|c|d|e)f/i;1149string = 'EF';1150actualmatch = string.match(pattern);1151expectedmatch = Array('EF', 'E');1152addThis();1153status = inSection(175);1154pattern = /abcd*efg/i;1155string = 'ABCDEFG';1156actualmatch = string.match(pattern);1157expectedmatch = Array('ABCDEFG');1158addThis();1159status = inSection(176);1160pattern = /ab*/i;1161string = 'XABYABBBZ';1162actualmatch = string.match(pattern);1163expectedmatch = Array('AB');1164addThis();1165status = inSection(177);1166pattern = /ab*/i;1167string = 'XAYABBBZ';1168actualmatch = string.match(pattern);1169expectedmatch = Array('A');1170addThis();1171status = inSection(178);1172pattern = /(ab|cd)e/i;1173string = 'ABCDE';1174actualmatch = string.match(pattern);1175expectedmatch = Array('CDE', 'CD');1176addThis();1177status = inSection(179);1178pattern = /[abhgefdc]ij/i;1179string = 'HIJ';1180actualmatch = string.match(pattern);1181expectedmatch = Array('HIJ');1182addThis();1183status = inSection(180);1184pattern = /(abc|)ef/i;1185string = 'ABCDEF';1186actualmatch = string.match(pattern);1187expectedmatch = Array('EF', '');1188addThis();1189status = inSection(181);1190pattern = /(a|b)c*d/i;1191string = 'ABCD';1192actualmatch = string.match(pattern);1193expectedmatch = Array('BCD', 'B');1194addThis();1195status = inSection(182);1196pattern = /(ab|ab*)bc/i;1197string = 'ABC';1198actualmatch = string.match(pattern);1199expectedmatch = Array('ABC', 'A');1200addThis();1201status = inSection(183);1202pattern = /a([bc]*)c*/i;1203string = 'ABC';1204actualmatch = string.match(pattern);1205expectedmatch = Array('ABC', 'BC');1206addThis();1207status = inSection(184);1208pattern = /a([bc]*)(c*d)/i;1209string = 'ABCD';1210actualmatch = string.match(pattern);1211expectedmatch = Array('ABCD', 'BC', 'D');1212addThis();1213status = inSection(185);1214pattern = /a([bc]+)(c*d)/i;1215string = 'ABCD';1216actualmatch = string.match(pattern);1217expectedmatch = Array('ABCD', 'BC', 'D');1218addThis();1219status = inSection(186);1220pattern = /a([bc]*)(c+d)/i;1221string = 'ABCD';1222actualmatch = string.match(pattern);1223expectedmatch = Array('ABCD', 'B', 'CD');1224addThis();1225status = inSection(187);1226pattern = /a[bcd]*dcdcde/i;1227string = 'ADCDCDE';1228actualmatch = string.match(pattern);1229expectedmatch = Array('ADCDCDE');1230addThis();1231status = inSection(188);1232pattern = /(ab|a)b*c/i;1233string = 'ABC';1234actualmatch = string.match(pattern);1235expectedmatch = Array('ABC', 'AB');1236addThis();1237status = inSection(189);1238pattern = /((a)(b)c)(d)/i;1239string = 'ABCD';1240actualmatch = string.match(pattern);1241expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D');1242addThis();1243status = inSection(190);1244pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i;1245string = 'ALPHA';1246actualmatch = string.match(pattern);1247expectedmatch = Array('ALPHA');1248addThis();1249status = inSection(191);1250pattern = /^a(bc+|b[eh])g|.h$/i;1251string = 'ABH';1252actualmatch = string.match(pattern);1253expectedmatch = Array('BH', undefined);1254addThis();1255status = inSection(192);1256pattern = /(bc+d$|ef*g.|h?i(j|k))/i;1257string = 'EFFGZ';1258actualmatch = string.match(pattern);1259expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);1260addThis();1261status = inSection(193);1262pattern = /(bc+d$|ef*g.|h?i(j|k))/i;1263string = 'IJ';1264actualmatch = string.match(pattern);1265expectedmatch = Array('IJ', 'IJ', 'J');1266addThis();1267status = inSection(194);1268pattern = /(bc+d$|ef*g.|h?i(j|k))/i;1269string = 'REFFGZ';1270actualmatch = string.match(pattern);1271expectedmatch = Array('EFFGZ', 'EFFGZ', undefined);1272addThis();1273status = inSection(195);1274pattern = /((((((((((a))))))))))/i;1275string = 'A';1276actualmatch = string.match(pattern);1277expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');1278addThis();1279status = inSection(196);1280pattern = /((((((((((a))))))))))\10/i;1281string = 'AA';1282actualmatch = string.match(pattern);1283expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');1284addThis();1285status = inSection(197);1286pattern = /((((((((((a))))))))))/i;1287string = 'A!';1288actualmatch = string.match(pattern);1289expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');1290addThis();1291status = inSection(198);1292pattern = /(((((((((a)))))))))/i;1293string = 'A';1294actualmatch = string.match(pattern);1295expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A');1296addThis();1297status = inSection(199);1298pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i;1299string = 'A';1300actualmatch = string.match(pattern);1301expectedmatch = Array('A', 'A');1302addThis();1303status = inSection(200);1304pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i;1305string = 'C';1306actualmatch = string.match(pattern);1307expectedmatch = Array('C', 'C');1308addThis();1309status = inSection(201);1310pattern = /(.*)c(.*)/i;1311string = 'ABCDE';1312actualmatch = string.match(pattern);1313expectedmatch = Array('ABCDE', 'AB', 'DE');1314addThis();1315status = inSection(202);1316pattern = /abcd/i;1317string = 'ABCD';1318actualmatch = string.match(pattern);1319expectedmatch = Array('ABCD');1320addThis();1321status = inSection(203);1322pattern = /a(bc)d/i;1323string = 'ABCD';1324actualmatch = string.match(pattern);1325expectedmatch = Array('ABCD', 'BC');1326addThis();1327status = inSection(204);1328pattern = /a[-]?c/i;1329string = 'AC';1330actualmatch = string.match(pattern);1331expectedmatch = Array('AC');1332addThis();1333status = inSection(205);1334pattern = /(abc)\1/i;1335string = 'ABCABC';1336actualmatch = string.match(pattern);1337expectedmatch = Array('ABCABC', 'ABC');1338addThis();1339status = inSection(206);1340pattern = /([a-c]*)\1/i;1341string = 'ABCABC';1342actualmatch = string.match(pattern);1343expectedmatch = Array('ABCABC', 'ABC');1344addThis();1345status = inSection(207);1346pattern = /a(?!b)./;1347string = 'abad';1348actualmatch = string.match(pattern);1349expectedmatch = Array('ad');1350addThis();1351status = inSection(208);1352pattern = /a(?=d)./;1353string = 'abad';1354actualmatch = string.match(pattern);1355expectedmatch = Array('ad');1356addThis();1357status = inSection(209);1358pattern = /a(?=c|d)./;1359string = 'abad';1360actualmatch = string.match(pattern);1361expectedmatch = Array('ad');1362addThis();1363status = inSection(210);1364pattern = /a(?:b|c|d)(.)/;1365string = 'ace';1366actualmatch = string.match(pattern);1367expectedmatch = Array('ace', 'e');1368addThis();1369status = inSection(211);1370pattern = /a(?:b|c|d)*(.)/;1371string = 'ace';1372actualmatch = string.match(pattern);1373expectedmatch = Array('ace', 'e');1374addThis();1375status = inSection(212);1376pattern = /a(?:b|c|d)+?(.)/;1377string = 'ace';1378actualmatch = string.match(pattern);1379expectedmatch = Array('ace', 'e');1380addThis();1381status = inSection(213);1382pattern = /a(?:b|c|d)+?(.)/;1383string = 'acdbcdbe';1384actualmatch = string.match(pattern);1385expectedmatch = Array('acd', 'd');1386addThis();1387status = inSection(214);1388pattern = /a(?:b|c|d)+(.)/;1389string = 'acdbcdbe';1390actualmatch = string.match(pattern);1391expectedmatch = Array('acdbcdbe', 'e');1392addThis();1393status = inSection(215);1394pattern = /a(?:b|c|d){2}(.)/;1395string = 'acdbcdbe';1396actualmatch = string.match(pattern);1397expectedmatch = Array('acdb', 'b');1398addThis();1399status = inSection(216);1400pattern = /a(?:b|c|d){4,5}(.)/;1401string = 'acdbcdbe';1402actualmatch = string.match(pattern);1403expectedmatch = Array('acdbcdb', 'b');1404addThis();1405status = inSection(217);1406pattern = /a(?:b|c|d){4,5}?(.)/;1407string = 'acdbcdbe';1408actualmatch = string.match(pattern);1409expectedmatch = Array('acdbcd', 'd');1410addThis();1411// MODIFIED - ECMA has different rules for paren contents1412status = inSection(218);1413pattern = /((foo)|(bar))*/;1414string = 'foobar';1415actualmatch = string.match(pattern);1416//expectedmatch = Array('foobar', 'bar', 'foo', 'bar');1417expectedmatch = Array('foobar', 'bar', undefined, 'bar');1418addThis();1419status = inSection(219);1420pattern = /a(?:b|c|d){6,7}(.)/;1421string = 'acdbcdbe';1422actualmatch = string.match(pattern);1423expectedmatch = Array('acdbcdbe', 'e');1424addThis();1425status = inSection(220);1426pattern = /a(?:b|c|d){6,7}?(.)/;1427string = 'acdbcdbe';1428actualmatch = string.match(pattern);1429expectedmatch = Array('acdbcdbe', 'e');1430addThis();1431status = inSection(221);1432pattern = /a(?:b|c|d){5,6}(.)/;1433string = 'acdbcdbe';1434actualmatch = string.match(pattern);1435expectedmatch = Array('acdbcdbe', 'e');1436addThis();1437status = inSection(222);1438pattern = /a(?:b|c|d){5,6}?(.)/;1439string = 'acdbcdbe';1440actualmatch = string.match(pattern);1441expectedmatch = Array('acdbcdb', 'b');1442addThis();1443status = inSection(223);1444pattern = /a(?:b|c|d){5,7}(.)/;1445string = 'acdbcdbe';1446actualmatch = string.match(pattern);1447expectedmatch = Array('acdbcdbe', 'e');1448addThis();1449status = inSection(224);1450pattern = /a(?:b|c|d){5,7}?(.)/;1451string = 'acdbcdbe';1452actualmatch = string.match(pattern);1453expectedmatch = Array('acdbcdb', 'b');1454addThis();1455status = inSection(225);1456pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/;1457string = 'ace';1458actualmatch = string.match(pattern);1459expectedmatch = Array('ace', 'c', 'e');1460addThis();1461status = inSection(226);1462pattern = /^(.+)?B/;1463string = 'AB';1464actualmatch = string.match(pattern);1465expectedmatch = Array('AB', 'A');1466addThis();1467/* MODIFIED - ECMA has different rules for paren contents */1468status = inSection(227);1469pattern = /^([^a-z])|(\^)$/;1470string = '.';1471actualmatch = string.match(pattern);1472//expectedmatch = Array('.', '.', '');1473expectedmatch = Array('.', '.', undefined);1474addThis();1475status = inSection(228);1476pattern = /^[<>]&/;1477string = '<&OUT';1478actualmatch = string.match(pattern);1479expectedmatch = Array('<&');1480addThis();1481/* Can't refer to a capture before it's encountered & completed1482status = inSection(229);1483pattern = /^(a\1?){4}$/;1484string = 'aaaaaaaaaa';1485actualmatch = string.match(pattern);1486expectedmatch = Array('aaaaaaaaaa', 'aaaa');1487addThis();1488status = inSection(230);1489pattern = /^(a(?(1)\1)){4}$/;1490string = 'aaaaaaaaaa';1491actualmatch = string.match(pattern);1492expectedmatch = Array('aaaaaaaaaa', 'aaaa');1493addThis();1494*/1495status = inSection(231);1496pattern = /((a{4})+)/;1497string = 'aaaaaaaaa';1498actualmatch = string.match(pattern);1499expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa');1500addThis();1501status = inSection(232);1502pattern = /(((aa){2})+)/;1503string = 'aaaaaaaaaa';1504actualmatch = string.match(pattern);1505expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');1506addThis();1507status = inSection(233);1508pattern = /(((a{2}){2})+)/;1509string = 'aaaaaaaaaa';1510actualmatch = string.match(pattern);1511expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa');1512addThis();1513status = inSection(234);1514pattern = /(?:(f)(o)(o)|(b)(a)(r))*/;1515string = 'foobar';1516actualmatch = string.match(pattern);1517//expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r');1518expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r');1519addThis();1520/* ECMA supports (?: (?= and (?! but doesn't support (?< etc.1521status = inSection(235);1522pattern = /(?<=a)b/;1523string = 'ab';1524actualmatch = string.match(pattern);1525expectedmatch = Array('b');1526addThis();1527status = inSection(236);1528pattern = /(?<!c)b/;1529string = 'ab';1530actualmatch = string.match(pattern);1531expectedmatch = Array('b');1532addThis();1533status = inSection(237);1534pattern = /(?<!c)b/;1535string = 'b';1536actualmatch = string.match(pattern);1537expectedmatch = Array('b');1538addThis();1539status = inSection(238);1540pattern = /(?<!c)b/;1541string = 'b';1542actualmatch = string.match(pattern);1543expectedmatch = Array('b');1544addThis();1545*/1546status = inSection(239);1547pattern = /(?:..)*a/;1548string = 'aba';1549actualmatch = string.match(pattern);1550expectedmatch = Array('aba');1551addThis();1552status = inSection(240);1553pattern = /(?:..)*?a/;1554string = 'aba';1555actualmatch = string.match(pattern);1556expectedmatch = Array('a');1557addThis();1558/*1559 * MODIFIED - ECMA has different rules for paren contents. Note1560 * this regexp has two non-capturing parens, and one capturing1561 *1562 * The issue: shouldn't the match be ['ab', undefined]? Because the1563 * '\1' matches the undefined value of the second iteration of the '*'1564 * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b'].1565 *1566 * Answer: waldemar@netscape.com:1567 *1568 * The correct answer is ['ab', undefined]. Perl doesn't match1569 * ECMAScript here, and I'd say that Perl is wrong in this case.1570 */1571status = inSection(241);1572pattern = /^(?:b|a(?=(.)))*\1/;1573string = 'abc';1574actualmatch = string.match(pattern);1575//expectedmatch = Array('ab', 'b');1576expectedmatch = Array('ab', undefined);1577addThis();1578status = inSection(242);1579pattern = /^(){3,5}/;1580string = 'abc';1581actualmatch = string.match(pattern);1582expectedmatch = Array('', '');1583addThis();1584status = inSection(243);1585pattern = /^(a+)*ax/;1586string = 'aax';1587actualmatch = string.match(pattern);1588expectedmatch = Array('aax', 'a');1589addThis();1590status = inSection(244);1591pattern = /^((a|b)+)*ax/;1592string = 'aax';1593actualmatch = string.match(pattern);1594expectedmatch = Array('aax', 'a', 'a');1595addThis();1596status = inSection(245);1597pattern = /^((a|bc)+)*ax/;1598string = 'aax';1599actualmatch = string.match(pattern);1600expectedmatch = Array('aax', 'a', 'a');1601addThis();1602/* MODIFIED - ECMA has different rules for paren contents */1603status = inSection(246);1604pattern = /(a|x)*ab/;1605string = 'cab';1606actualmatch = string.match(pattern);1607//expectedmatch = Array('ab', '');1608expectedmatch = Array('ab', undefined);1609addThis();1610status = inSection(247);1611pattern = /(a)*ab/;1612string = 'cab';1613actualmatch = string.match(pattern);1614expectedmatch = Array('ab', undefined);1615addThis();1616/* ECMA doesn't support (?imsx or (?-imsx1617status = inSection(248);1618pattern = /(?:(?i)a)b/;1619string = 'ab';1620actualmatch = string.match(pattern);1621expectedmatch = Array('ab');1622addThis();1623status = inSection(249);1624pattern = /((?i)a)b/;1625string = 'ab';1626actualmatch = string.match(pattern);1627expectedmatch = Array('ab', 'a');1628addThis();1629status = inSection(250);1630pattern = /(?:(?i)a)b/;1631string = 'Ab';1632actualmatch = string.match(pattern);1633expectedmatch = Array('Ab');1634addThis();1635status = inSection(251);1636pattern = /((?i)a)b/;1637string = 'Ab';1638actualmatch = string.match(pattern);1639expectedmatch = Array('Ab', 'A');1640addThis();1641status = inSection(252);1642pattern = /(?i:a)b/;1643string = 'ab';1644actualmatch = string.match(pattern);1645expectedmatch = Array('ab');1646addThis();1647status = inSection(253);1648pattern = /((?i:a))b/;1649string = 'ab';1650actualmatch = string.match(pattern);1651expectedmatch = Array('ab', 'a');1652addThis();1653status = inSection(254);1654pattern = /(?i:a)b/;1655string = 'Ab';1656actualmatch = string.match(pattern);1657expectedmatch = Array('Ab');1658addThis();1659status = inSection(255);1660pattern = /((?i:a))b/;1661string = 'Ab';1662actualmatch = string.match(pattern);1663expectedmatch = Array('Ab', 'A');1664addThis();1665status = inSection(256);1666pattern = /(?:(?-i)a)b/i;1667string = 'ab';1668actualmatch = string.match(pattern);1669expectedmatch = Array('ab');1670addThis();1671status = inSection(257);1672pattern = /((?-i)a)b/i;1673string = 'ab';1674actualmatch = string.match(pattern);1675expectedmatch = Array('ab', 'a');1676addThis();1677status = inSection(258);1678pattern = /(?:(?-i)a)b/i;1679string = 'aB';1680actualmatch = string.match(pattern);1681expectedmatch = Array('aB');1682addThis();1683status = inSection(259);1684pattern = /((?-i)a)b/i;1685string = 'aB';1686actualmatch = string.match(pattern);1687expectedmatch = Array('aB', 'a');1688addThis();1689status = inSection(260);1690pattern = /(?:(?-i)a)b/i;1691string = 'aB';1692actualmatch = string.match(pattern);1693expectedmatch = Array('aB');1694addThis();1695status = inSection(261);1696pattern = /((?-i)a)b/i;1697string = 'aB';1698actualmatch = string.match(pattern);1699expectedmatch = Array('aB', 'a');1700addThis();1701status = inSection(262);1702pattern = /(?-i:a)b/i;1703string = 'ab';1704actualmatch = string.match(pattern);1705expectedmatch = Array('ab');1706addThis();1707status = inSection(263);1708pattern = /((?-i:a))b/i;1709string = 'ab';1710actualmatch = string.match(pattern);1711expectedmatch = Array('ab', 'a');1712addThis();1713status = inSection(264);1714pattern = /(?-i:a)b/i;1715string = 'aB';1716actualmatch = string.match(pattern);1717expectedmatch = Array('aB');1718addThis();1719status = inSection(265);1720pattern = /((?-i:a))b/i;1721string = 'aB';1722actualmatch = string.match(pattern);1723expectedmatch = Array('aB', 'a');1724addThis();1725status = inSection(266);1726pattern = /(?-i:a)b/i;1727string = 'aB';1728actualmatch = string.match(pattern);1729expectedmatch = Array('aB');1730addThis();1731status = inSection(267);1732pattern = /((?-i:a))b/i;1733string = 'aB';1734actualmatch = string.match(pattern);1735expectedmatch = Array('aB', 'a');1736addThis();1737status = inSection(268);1738pattern = /((?s-i:a.))b/i;1739string = 'a\nB';1740actualmatch = string.match(pattern);1741expectedmatch = Array('a\nB', 'a\n');1742addThis();1743*/1744status = inSection(269);1745pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/;1746string = 'cabbbb';1747actualmatch = string.match(pattern);1748expectedmatch = Array('cabbbb');1749addThis();1750status = inSection(270);1751pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/;1752string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';1753actualmatch = string.match(pattern);1754expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');1755addThis();1756status = inSection(271);1757pattern = /(ab)\d\1/i;1758string = 'Ab4ab';1759actualmatch = string.match(pattern);1760expectedmatch = Array('Ab4ab', 'Ab');1761addThis();1762status = inSection(272);1763pattern = /(ab)\d\1/i;1764string = 'ab4Ab';1765actualmatch = string.match(pattern);1766expectedmatch = Array('ab4Ab', 'ab');1767addThis();1768status = inSection(273);1769pattern = /foo\w*\d{4}baz/;1770string = 'foobar1234baz';1771actualmatch = string.match(pattern);1772expectedmatch = Array('foobar1234baz');1773addThis();1774status = inSection(274);1775pattern = /x(~~)*(?:(?:F)?)?/;1776string = 'x~~';1777actualmatch = string.match(pattern);1778expectedmatch = Array('x~~', '~~');1779addThis();1780/* Perl supports (?# but JS doesn't1781status = inSection(275);1782pattern = /^a(?#xxx){3}c/;1783string = 'aaac';1784actualmatch = string.match(pattern);1785expectedmatch = Array('aaac');1786addThis();1787*/1788/* ECMA doesn't support (?< etc1789status = inSection(276);1790pattern = /(?<![cd])[ab]/;1791string = 'dbaacb';1792actualmatch = string.match(pattern);1793expectedmatch = Array('a');1794addThis();1795status = inSection(277);1796pattern = /(?<!(c|d))[ab]/;1797string = 'dbaacb';1798actualmatch = string.match(pattern);1799expectedmatch = Array('a');1800addThis();1801status = inSection(278);1802pattern = /(?<!cd)[ab]/;1803string = 'cdaccb';1804actualmatch = string.match(pattern);1805expectedmatch = Array('b');1806addThis();1807status = inSection(279);1808pattern = /((?s)^a(.))((?m)^b$)/;1809string = 'a\nb\nc\n';1810actualmatch = string.match(pattern);1811expectedmatch = Array('a\nb', 'a\n', '\n', 'b');1812addThis();1813status = inSection(280);1814pattern = /((?m)^b$)/;1815string = 'a\nb\nc\n';1816actualmatch = string.match(pattern);1817expectedmatch = Array('b', 'b');1818addThis();1819status = inSection(281);1820pattern = /(?m)^b/;1821string = 'a\nb\n';1822actualmatch = string.match(pattern);1823expectedmatch = Array('b');1824addThis();1825status = inSection(282);1826pattern = /(?m)^(b)/;1827string = 'a\nb\n';1828actualmatch = string.match(pattern);1829expectedmatch = Array('b', 'b');1830addThis();1831status = inSection(283);1832pattern = /((?m)^b)/;1833string = 'a\nb\n';1834actualmatch = string.match(pattern);1835expectedmatch = Array('b', 'b');1836addThis();1837status = inSection(284);1838pattern = /\n((?m)^b)/;1839string = 'a\nb\n';1840actualmatch = string.match(pattern);1841expectedmatch = Array('\nb', 'b');1842addThis();1843status = inSection(285);1844pattern = /((?s).)c(?!.)/;1845string = 'a\nb\nc\n';1846actualmatch = string.match(pattern);1847expectedmatch = Array('\nc', '\n');1848addThis();1849status = inSection(286);1850pattern = /((?s).)c(?!.)/;1851string = 'a\nb\nc\n';1852actualmatch = string.match(pattern);1853expectedmatch = Array('\nc', '\n');1854addThis();1855status = inSection(287);1856pattern = /((?s)b.)c(?!.)/;1857string = 'a\nb\nc\n';1858actualmatch = string.match(pattern);1859expectedmatch = Array('b\nc', 'b\n');1860addThis();1861status = inSection(288);1862pattern = /((?s)b.)c(?!.)/;1863string = 'a\nb\nc\n';1864actualmatch = string.match(pattern);1865expectedmatch = Array('b\nc', 'b\n');1866addThis();1867status = inSection(289);1868pattern = /((?m)^b)/;1869string = 'a\nb\nc\n';1870actualmatch = string.match(pattern);1871expectedmatch = Array('b', 'b');1872addThis();1873*/1874/* ECMA doesn't support (?(condition)1875status = inSection(290);1876pattern = /(?(1)b|a)/;1877string = 'a';1878actualmatch = string.match(pattern);1879expectedmatch = Array('a');1880addThis();1881status = inSection(291);1882pattern = /(x)?(?(1)b|a)/;1883string = 'a';1884actualmatch = string.match(pattern);1885expectedmatch = Array('a');1886addThis();1887status = inSection(292);1888pattern = /()?(?(1)b|a)/;1889string = 'a';1890actualmatch = string.match(pattern);1891expectedmatch = Array('a');1892addThis();1893status = inSection(293);1894pattern = /()?(?(1)a|b)/;1895string = 'a';1896actualmatch = string.match(pattern);1897expectedmatch = Array('a');1898addThis();1899status = inSection(294);1900pattern = /^(\()?blah(?(1)(\)))$/;1901string = '(blah)';1902actualmatch = string.match(pattern);1903expectedmatch = Array('(blah)', '(', ')');1904addThis();1905status = inSection(295);1906pattern = /^(\()?blah(?(1)(\)))$/;1907string = 'blah';1908actualmatch = string.match(pattern);1909expectedmatch = Array('blah');1910addThis();1911status = inSection(296);1912pattern = /^(\(+)?blah(?(1)(\)))$/;1913string = '(blah)';1914actualmatch = string.match(pattern);1915expectedmatch = Array('(blah)', '(', ')');1916addThis();1917status = inSection(297);1918pattern = /^(\(+)?blah(?(1)(\)))$/;1919string = 'blah';1920actualmatch = string.match(pattern);1921expectedmatch = Array('blah');1922addThis();1923status = inSection(298);1924pattern = /(?(?!a)b|a)/;1925string = 'a';1926actualmatch = string.match(pattern);1927expectedmatch = Array('a');1928addThis();1929status = inSection(299);1930pattern = /(?(?=a)a|b)/;1931string = 'a';1932actualmatch = string.match(pattern);1933expectedmatch = Array('a');1934addThis();1935*/1936status = inSection(300);1937pattern = /(?=(a+?))(\1ab)/;1938string = 'aaab';1939actualmatch = string.match(pattern);1940expectedmatch = Array('aab', 'a', 'aab');1941addThis();1942status = inSection(301);1943pattern = /(\w+:)+/;1944string = 'one:';1945actualmatch = string.match(pattern);1946expectedmatch = Array('one:', 'one:');1947addThis();1948/* ECMA doesn't support (?< etc1949status = inSection(302);1950pattern = /$(?<=^(a))/;1951string = 'a';1952actualmatch = string.match(pattern);1953expectedmatch = Array('', 'a');1954addThis();1955*/1956status = inSection(303);1957pattern = /(?=(a+?))(\1ab)/;1958string = 'aaab';1959actualmatch = string.match(pattern);1960expectedmatch = Array('aab', 'a', 'aab');1961addThis();1962/* MODIFIED - ECMA has different rules for paren contents */1963status = inSection(304);1964pattern = /([\w:]+::)?(\w+)$/;1965string = 'abcd';1966actualmatch = string.match(pattern);1967//expectedmatch = Array('abcd', '', 'abcd');1968expectedmatch = Array('abcd', undefined, 'abcd');1969addThis();1970status = inSection(305);1971pattern = /([\w:]+::)?(\w+)$/;1972string = 'xy:z:::abcd';1973actualmatch = string.match(pattern);1974expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');1975addThis();1976status = inSection(306);1977pattern = /^[^bcd]*(c+)/;1978string = 'aexycd';1979actualmatch = string.match(pattern);1980expectedmatch = Array('aexyc', 'c');1981addThis();1982status = inSection(307);1983pattern = /(a*)b+/;1984string = 'caab';1985actualmatch = string.match(pattern);1986expectedmatch = Array('aab', 'aa');1987addThis();1988/* MODIFIED - ECMA has different rules for paren contents */1989status = inSection(308);1990pattern = /([\w:]+::)?(\w+)$/;1991string = 'abcd';1992actualmatch = string.match(pattern);1993//expectedmatch = Array('abcd', '', 'abcd');1994expectedmatch = Array('abcd', undefined, 'abcd');1995addThis();1996status = inSection(309);1997pattern = /([\w:]+::)?(\w+)$/;1998string = 'xy:z:::abcd';1999actualmatch = string.match(pattern);2000expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd');2001addThis();2002status = inSection(310);2003pattern = /^[^bcd]*(c+)/;2004string = 'aexycd';2005actualmatch = string.match(pattern);2006expectedmatch = Array('aexyc', 'c');2007addThis();2008/* ECMA doesn't support (?>2009status = inSection(311);2010pattern = /(?>a+)b/;2011string = 'aaab';2012actualmatch = string.match(pattern);2013expectedmatch = Array('aaab');2014addThis();2015*/2016status = inSection(312);2017pattern = /([[:]+)/;2018string = 'a:[b]:';2019actualmatch = string.match(pattern);2020expectedmatch = Array(':[', ':[');2021addThis();2022status = inSection(313);2023pattern = /([[=]+)/;2024string = 'a=[b]=';2025actualmatch = string.match(pattern);2026expectedmatch = Array('=[', '=[');2027addThis();2028status = inSection(314);2029pattern = /([[.]+)/;2030string = 'a.[b].';2031actualmatch = string.match(pattern);2032expectedmatch = Array('.[', '.[');2033addThis();2034/* ECMA doesn't have rules for [:2035status = inSection(315);2036pattern = /[a[:]b[:c]/;2037string = 'abc';2038actualmatch = string.match(pattern);2039expectedmatch = Array('abc');2040addThis();2041*/2042/* ECMA doesn't support (?>2043status = inSection(316);2044pattern = /((?>a+)b)/;2045string = 'aaab';2046actualmatch = string.match(pattern);2047expectedmatch = Array('aaab', 'aaab');2048addThis();2049status = inSection(317);2050pattern = /(?>(a+))b/;2051string = 'aaab';2052actualmatch = string.match(pattern);2053expectedmatch = Array('aaab', 'aaa');2054addThis();2055status = inSection(318);2056pattern = /((?>[^()]+)|\([^()]*\))+/;2057string = '((abc(ade)ufh()()x';2058actualmatch = string.match(pattern);2059expectedmatch = Array('abc(ade)ufh()()x', 'x');2060addThis();2061*/2062/* Perl has \Z has end-of-line, ECMA doesn't2063status = inSection(319);2064pattern = /\Z/;2065string = 'a\nb\n';2066actualmatch = string.match(pattern);2067expectedmatch = Array('');2068addThis();2069status = inSection(320);2070pattern = /\z/;2071string = 'a\nb\n';2072actualmatch = string.match(pattern);2073expectedmatch = Array('');2074addThis();2075*/2076status = inSection(321);2077pattern = /$/;2078string = 'a\nb\n';2079actualmatch = string.match(pattern);2080expectedmatch = Array('');2081addThis();2082/* Perl has \Z has end-of-line, ECMA doesn't2083status = inSection(322);2084pattern = /\Z/;2085string = 'b\na\n';2086actualmatch = string.match(pattern);2087expectedmatch = Array('');2088addThis();2089status = inSection(323);2090pattern = /\z/;2091string = 'b\na\n';2092actualmatch = string.match(pattern);2093expectedmatch = Array('');2094addThis();2095*/2096status = inSection(324);2097pattern = /$/;2098string = 'b\na\n';2099actualmatch = string.match(pattern);2100expectedmatch = Array('');2101addThis();2102/* Perl has \Z has end-of-line, ECMA doesn't2103status = inSection(325);2104pattern = /\Z/;2105string = 'b\na';2106actualmatch = string.match(pattern);2107expectedmatch = Array('');2108addThis();2109status = inSection(326);2110pattern = /\z/;2111string = 'b\na';2112actualmatch = string.match(pattern);2113expectedmatch = Array('');2114addThis();2115*/2116status = inSection(327);2117pattern = /$/;2118string = 'b\na';2119actualmatch = string.match(pattern);2120expectedmatch = Array('');2121addThis();2122/* Perl has \Z has end-of-line, ECMA doesn't2123status = inSection(328);2124pattern = /\Z/m;2125string = 'a\nb\n';2126actualmatch = string.match(pattern);2127expectedmatch = Array('');2128addThis();2129status = inSection(329);2130pattern = /\z/m;2131string = 'a\nb\n';2132actualmatch = string.match(pattern);2133expectedmatch = Array('');2134addThis();2135*/2136status = inSection(330);2137pattern = /$/m;2138string = 'a\nb\n';2139actualmatch = string.match(pattern);2140expectedmatch = Array('');2141addThis();2142/* Perl has \Z has end-of-line, ECMA doesn't2143status = inSection(331);2144pattern = /\Z/m;2145string = 'b\na\n';2146actualmatch = string.match(pattern);2147expectedmatch = Array('');2148addThis();2149status = inSection(332);2150pattern = /\z/m;2151string = 'b\na\n';2152actualmatch = string.match(pattern);2153expectedmatch = Array('');2154addThis();2155*/2156status = inSection(333);2157pattern = /$/m;2158string = 'b\na\n';2159actualmatch = string.match(pattern);2160expectedmatch = Array('');2161addThis();2162/* Perl has \Z has end-of-line, ECMA doesn't2163status = inSection(334);2164pattern = /\Z/m;2165string = 'b\na';2166actualmatch = string.match(pattern);2167expectedmatch = Array('');2168addThis();2169status = inSection(335);2170pattern = /\z/m;2171string = 'b\na';2172actualmatch = string.match(pattern);2173expectedmatch = Array('');2174addThis();2175*/2176status = inSection(336);2177pattern = /$/m;2178string = 'b\na';2179actualmatch = string.match(pattern);2180expectedmatch = Array('');2181addThis();2182/* Perl has \Z has end-of-line, ECMA doesn't2183status = inSection(337);2184pattern = /a\Z/;2185string = 'b\na\n';2186actualmatch = string.match(pattern);2187expectedmatch = Array('a');2188addThis();2189*/2190/* $ only matches end of input unless multiline2191status = inSection(338);2192pattern = /a$/;2193string = 'b\na\n';2194actualmatch = string.match(pattern);2195expectedmatch = Array('a');2196addThis();2197*/2198/* Perl has \Z has end-of-line, ECMA doesn't2199status = inSection(339);2200pattern = /a\Z/;2201string = 'b\na';2202actualmatch = string.match(pattern);2203expectedmatch = Array('a');2204addThis();2205status = inSection(340);2206pattern = /a\z/;2207string = 'b\na';2208actualmatch = string.match(pattern);2209expectedmatch = Array('a');2210addThis();2211*/2212status = inSection(341);2213pattern = /a$/;2214string = 'b\na';2215actualmatch = string.match(pattern);2216expectedmatch = Array('a');2217addThis();2218status = inSection(342);2219pattern = /a$/m;2220string = 'a\nb\n';2221actualmatch = string.match(pattern);2222expectedmatch = Array('a');2223addThis();2224/* Perl has \Z has end-of-line, ECMA doesn't2225status = inSection(343);2226pattern = /a\Z/m;2227string = 'b\na\n';2228actualmatch = string.match(pattern);2229expectedmatch = Array('a');2230addThis();2231*/2232status = inSection(344);2233pattern = /a$/m;2234string = 'b\na\n';2235actualmatch = string.match(pattern);2236expectedmatch = Array('a');2237addThis();2238/* Perl has \Z has end-of-line, ECMA doesn't2239status = inSection(345);2240pattern = /a\Z/m;2241string = 'b\na';2242actualmatch = string.match(pattern);2243expectedmatch = Array('a');2244addThis();2245status = inSection(346);2246pattern = /a\z/m;2247string = 'b\na';2248actualmatch = string.match(pattern);2249expectedmatch = Array('a');2250addThis();2251*/2252status = inSection(347);2253pattern = /a$/m;2254string = 'b\na';2255actualmatch = string.match(pattern);2256expectedmatch = Array('a');2257addThis();2258/* Perl has \Z has end-of-line, ECMA doesn't2259status = inSection(348);2260pattern = /aa\Z/;2261string = 'b\naa\n';2262actualmatch = string.match(pattern);2263expectedmatch = Array('aa');2264addThis();2265*/2266/* $ only matches end of input unless multiline2267status = inSection(349);2268pattern = /aa$/;2269string = 'b\naa\n';2270actualmatch = string.match(pattern);2271expectedmatch = Array('aa');2272addThis();2273*/2274/* Perl has \Z has end-of-line, ECMA doesn't2275status = inSection(350);2276pattern = /aa\Z/;2277string = 'b\naa';2278actualmatch = string.match(pattern);2279expectedmatch = Array('aa');2280addThis();2281status = inSection(351);2282pattern = /aa\z/;2283string = 'b\naa';2284actualmatch = string.match(pattern);2285expectedmatch = Array('aa');2286addThis();2287*/2288status = inSection(352);2289pattern = /aa$/;2290string = 'b\naa';2291actualmatch = string.match(pattern);2292expectedmatch = Array('aa');2293addThis();2294status = inSection(353);2295pattern = /aa$/m;2296string = 'aa\nb\n';2297actualmatch = string.match(pattern);2298expectedmatch = Array('aa');2299addThis();2300/* Perl has \Z has end-of-line, ECMA doesn't2301status = inSection(354);2302pattern = /aa\Z/m;2303string = 'b\naa\n';2304actualmatch = string.match(pattern);2305expectedmatch = Array('aa');2306addThis();2307*/2308status = inSection(355);2309pattern = /aa$/m;2310string = 'b\naa\n';2311actualmatch = string.match(pattern);2312expectedmatch = Array('aa');2313addThis();2314/* Perl has \Z has end-of-line, ECMA doesn't2315status = inSection(356);2316pattern = /aa\Z/m;2317string = 'b\naa';2318actualmatch = string.match(pattern);2319expectedmatch = Array('aa');2320addThis();2321status = inSection(357);2322pattern = /aa\z/m;2323string = 'b\naa';2324actualmatch = string.match(pattern);2325expectedmatch = Array('aa');2326addThis();2327*/2328status = inSection(358);2329pattern = /aa$/m;2330string = 'b\naa';2331actualmatch = string.match(pattern);2332expectedmatch = Array('aa');2333addThis();2334/* Perl has \Z has end-of-line, ECMA doesn't2335status = inSection(359);2336pattern = /ab\Z/;2337string = 'b\nab\n';2338actualmatch = string.match(pattern);2339expectedmatch = Array('ab');2340addThis();2341*/2342/* $ only matches end of input unless multiline2343status = inSection(360);2344pattern = /ab$/;2345string = 'b\nab\n';2346actualmatch = string.match(pattern);2347expectedmatch = Array('ab');2348addThis();2349*/2350/* Perl has \Z has end-of-line, ECMA doesn't2351status = inSection(361);2352pattern = /ab\Z/;2353string = 'b\nab';2354actualmatch = string.match(pattern);2355expectedmatch = Array('ab');2356addThis();2357status = inSection(362);2358pattern = /ab\z/;2359string = 'b\nab';2360actualmatch = string.match(pattern);2361expectedmatch = Array('ab');2362addThis();2363*/2364status = inSection(363);2365pattern = /ab$/;2366string = 'b\nab';2367actualmatch = string.match(pattern);2368expectedmatch = Array('ab');2369addThis();2370status = inSection(364);2371pattern = /ab$/m;2372string = 'ab\nb\n';2373actualmatch = string.match(pattern);2374expectedmatch = Array('ab');2375addThis();2376/* Perl has \Z has end-of-line, ECMA doesn't2377status = inSection(365);2378pattern = /ab\Z/m;2379string = 'b\nab\n';2380actualmatch = string.match(pattern);2381expectedmatch = Array('ab');2382addThis();2383*/2384status = inSection(366);2385pattern = /ab$/m;2386string = 'b\nab\n';2387actualmatch = string.match(pattern);2388expectedmatch = Array('ab');2389addThis();2390/* Perl has \Z has end-of-line, ECMA doesn't2391status = inSection(367);2392pattern = /ab\Z/m;2393string = 'b\nab';2394actualmatch = string.match(pattern);2395expectedmatch = Array('ab');2396addThis();2397status = inSection(368);2398pattern = /ab\z/m;2399string = 'b\nab';2400actualmatch = string.match(pattern);2401expectedmatch = Array('ab');2402addThis();2403*/2404status = inSection(369);2405pattern = /ab$/m;2406string = 'b\nab';2407actualmatch = string.match(pattern);2408expectedmatch = Array('ab');2409addThis();2410/* Perl has \Z has end-of-line, ECMA doesn't2411status = inSection(370);2412pattern = /abb\Z/;2413string = 'b\nabb\n';2414actualmatch = string.match(pattern);2415expectedmatch = Array('abb');2416addThis();2417*/2418/* $ only matches end of input unless multiline2419status = inSection(371);2420pattern = /abb$/;2421string = 'b\nabb\n';2422actualmatch = string.match(pattern);2423expectedmatch = Array('abb');2424addThis();2425*/2426/* Perl has \Z has end-of-line, ECMA doesn't2427status = inSection(372);2428pattern = /abb\Z/;2429string = 'b\nabb';2430actualmatch = string.match(pattern);2431expectedmatch = Array('abb');2432addThis();2433status = inSection(373);2434pattern = /abb\z/;2435string = 'b\nabb';2436actualmatch = string.match(pattern);2437expectedmatch = Array('abb');2438addThis();2439*/2440status = inSection(374);2441pattern = /abb$/;2442string = 'b\nabb';2443actualmatch = string.match(pattern);2444expectedmatch = Array('abb');2445addThis();2446status = inSection(375);2447pattern = /abb$/m;2448string = 'abb\nb\n';2449actualmatch = string.match(pattern);2450expectedmatch = Array('abb');2451addThis();2452/* Perl has \Z has end-of-line, ECMA doesn't2453status = inSection(376);2454pattern = /abb\Z/m;2455string = 'b\nabb\n';2456actualmatch = string.match(pattern);2457expectedmatch = Array('abb');2458addThis();2459*/2460status = inSection(377);2461pattern = /abb$/m;2462string = 'b\nabb\n';2463actualmatch = string.match(pattern);2464expectedmatch = Array('abb');2465addThis();2466/* Perl has \Z has end-of-line, ECMA doesn't2467status = inSection(378);2468pattern = /abb\Z/m;2469string = 'b\nabb';2470actualmatch = string.match(pattern);2471expectedmatch = Array('abb');2472addThis();2473status = inSection(379);2474pattern = /abb\z/m;2475string = 'b\nabb';2476actualmatch = string.match(pattern);2477expectedmatch = Array('abb');2478addThis();2479*/2480status = inSection(380);2481pattern = /abb$/m;2482string = 'b\nabb';2483actualmatch = string.match(pattern);2484expectedmatch = Array('abb');2485addThis();2486status = inSection(381);2487pattern = /(^|x)(c)/;2488string = 'ca';2489actualmatch = string.match(pattern);2490expectedmatch = Array('c', '', 'c');2491addThis();2492status = inSection(382);2493pattern = /foo.bart/;2494string = 'foo.bart';2495actualmatch = string.match(pattern);2496expectedmatch = Array('foo.bart');2497addThis();2498status = inSection(383);2499pattern = /^d[x][x][x]/m;2500string = 'abcd\ndxxx';2501actualmatch = string.match(pattern);2502expectedmatch = Array('dxxx');2503addThis();2504status = inSection(384);2505pattern = /tt+$/;2506string = 'xxxtt';2507actualmatch = string.match(pattern);2508expectedmatch = Array('tt');2509addThis();2510/* ECMA spec says that each atom in a range must be a single character2511status = inSection(385);2512pattern = /([a-\d]+)/;2513string = 'za-9z';2514actualmatch = string.match(pattern);2515expectedmatch = Array('9', '9');2516addThis();2517status = inSection(386);2518pattern = /([\d-z]+)/;2519string = 'a0-za';2520actualmatch = string.match(pattern);2521expectedmatch = Array('0-z', '0-z');2522addThis();2523*/2524/* ECMA doesn't support [:2525status = inSection(387);2526pattern = /([a-[:digit:]]+)/;2527string = 'za-9z';2528actualmatch = string.match(pattern);2529expectedmatch = Array('a-9', 'a-9');2530addThis();2531status = inSection(388);2532pattern = /([[:digit:]-z]+)/;2533string = '=0-z=';2534actualmatch = string.match(pattern);2535expectedmatch = Array('0-z', '0-z');2536addThis();2537status = inSection(389);2538pattern = /([[:digit:]-[:alpha:]]+)/;2539string = '=0-z=';2540actualmatch = string.match(pattern);2541expectedmatch = Array('0-z', '0-z');2542addThis();2543*/2544status = inSection(390);2545pattern = /(\d+\.\d+)/;2546string = '3.1415926';2547actualmatch = string.match(pattern);2548expectedmatch = Array('3.1415926', '3.1415926');2549addThis();2550status = inSection(391);2551pattern = /\.c(pp|xx|c)?$/i;2552string = 'IO.c';2553actualmatch = string.match(pattern);2554expectedmatch = Array('.c', undefined);2555addThis();2556status = inSection(392);2557pattern = /(\.c(pp|xx|c)?$)/i;2558string = 'IO.c';2559actualmatch = string.match(pattern);2560expectedmatch = Array('.c', '.c', undefined);2561addThis();2562status = inSection(393);2563pattern = /(^|a)b/;2564string = 'ab';2565actualmatch = string.match(pattern);2566expectedmatch = Array('ab', 'a');2567addThis();2568status = inSection(394);2569pattern = /^([ab]*?)(b)?(c)$/;2570string = 'abac';2571actualmatch = string.match(pattern);2572expectedmatch = Array('abac', 'aba', undefined, 'c');2573addThis();2574status = inSection(395);2575pattern = /^(?:.,){2}c/i;2576string = 'a,b,c';2577actualmatch = string.match(pattern);2578expectedmatch = Array('a,b,c');2579addThis();2580status = inSection(396);2581pattern = /^(.,){2}c/i;2582string = 'a,b,c';2583actualmatch = string.match(pattern);2584expectedmatch = Array('a,b,c', 'b,');2585addThis();2586status = inSection(397);2587pattern = /^(?:[^,]*,){2}c/;2588string = 'a,b,c';2589actualmatch = string.match(pattern);2590expectedmatch = Array('a,b,c');2591addThis();2592status = inSection(398);2593pattern = /^([^,]*,){2}c/;2594string = 'a,b,c';2595actualmatch = string.match(pattern);2596expectedmatch = Array('a,b,c', 'b,');2597addThis();2598status = inSection(399);2599pattern = /^([^,]*,){3}d/;2600string = 'aaa,b,c,d';2601actualmatch = string.match(pattern);2602expectedmatch = Array('aaa,b,c,d', 'c,');2603addThis();2604status = inSection(400);2605pattern = /^([^,]*,){3,}d/;2606string = 'aaa,b,c,d';2607actualmatch = string.match(pattern);2608expectedmatch = Array('aaa,b,c,d', 'c,');2609addThis();2610status = inSection(401);2611pattern = /^([^,]*,){0,3}d/;2612string = 'aaa,b,c,d';2613actualmatch = string.match(pattern);2614expectedmatch = Array('aaa,b,c,d', 'c,');2615addThis();2616status = inSection(402);2617pattern = /^([^,]{1,3},){3}d/i;2618string = 'aaa,b,c,d';2619actualmatch = string.match(pattern);2620expectedmatch = Array('aaa,b,c,d', 'c,');2621addThis();2622status = inSection(403);2623pattern = /^([^,]{1,3},){3,}d/;2624string = 'aaa,b,c,d';2625actualmatch = string.match(pattern);2626expectedmatch = Array('aaa,b,c,d', 'c,');2627addThis();2628status = inSection(404);2629pattern = /^([^,]{1,3},){0,3}d/;2630string = 'aaa,b,c,d';2631actualmatch = string.match(pattern);2632expectedmatch = Array('aaa,b,c,d', 'c,');2633addThis();2634status = inSection(405);2635pattern = /^([^,]{1,},){3}d/;2636string = 'aaa,b,c,d';2637actualmatch = string.match(pattern);2638expectedmatch = Array('aaa,b,c,d', 'c,');2639addThis();2640status = inSection(406);2641pattern = /^([^,]{1,},){3,}d/;2642string = 'aaa,b,c,d';2643actualmatch = string.match(pattern);2644expectedmatch = Array('aaa,b,c,d', 'c,');2645addThis();2646status = inSection(407);2647pattern = /^([^,]{1,},){0,3}d/;2648string = 'aaa,b,c,d';2649actualmatch = string.match(pattern);2650expectedmatch = Array('aaa,b,c,d', 'c,');2651addThis();2652status = inSection(408);2653pattern = /^([^,]{0,3},){3}d/i;2654string = 'aaa,b,c,d';2655actualmatch = string.match(pattern);2656expectedmatch = Array('aaa,b,c,d', 'c,');2657addThis();2658status = inSection(409);2659pattern = /^([^,]{0,3},){3,}d/;2660string = 'aaa,b,c,d';2661actualmatch = string.match(pattern);2662expectedmatch = Array('aaa,b,c,d', 'c,');2663addThis();2664status = inSection(410);2665pattern = /^([^,]{0,3},){0,3}d/;2666string = 'aaa,b,c,d';2667actualmatch = string.match(pattern);2668expectedmatch = Array('aaa,b,c,d', 'c,');2669addThis();2670/* ECMA doesn't support \A2671status = inSection(411);2672pattern = /(?!\A)x/m;2673string = 'a\nxb\n';2674actualmatch = string.match(pattern);2675expectedmatch = Array('\n');2676addThis();2677*/2678status = inSection(412);2679pattern = /^(a(b)?)+$/;2680string = 'aba';2681actualmatch = string.match(pattern);2682expectedmatch = Array('aba', 'a', undefined);2683addThis();2684status = inSection(413);2685pattern = /^(aa(bb)?)+$/;2686string = 'aabbaa';2687actualmatch = string.match(pattern);2688expectedmatch = Array('aabbaa', 'aa', undefined);2689addThis();2690status = inSection(414);2691pattern = /^.{9}abc.*\n/m;2692string = '123\nabcabcabcabc\n';2693actualmatch = string.match(pattern);2694expectedmatch = Array('abcabcabcabc\n');2695addThis();2696status = inSection(415);2697pattern = /^(a)?a$/;2698string = 'a';2699actualmatch = string.match(pattern);2700expectedmatch = Array('a', undefined);2701addThis();2702status = inSection(416);2703pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/;2704string = 'aaaaaa';2705actualmatch = string.match(pattern);2706expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa');2707addThis();2708/* Can't refer to a capture before it's encountered & completed2709status = inSection(417);2710pattern = /^(a\1?){4}$/;2711string = 'aaaaaa';2712actualmatch = string.match(pattern);2713expectedmatch = Array('aaaaaa', 'aaa');2714addThis();2715*/2716status = inSection(418);2717pattern = /^(0+)?(?:x(1))?/;2718string = 'x1';2719actualmatch = string.match(pattern);2720expectedmatch = Array('x1', undefined, '1');2721addThis();2722status = inSection(419);2723pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/;2724string = '012cxx0190';2725actualmatch = string.match(pattern);2726expectedmatch = Array('012cxx0190', '012c', undefined, '0190');2727addThis();2728status = inSection(420);2729pattern = /^(b+?|a){1,2}c/;2730string = 'bbbac';2731actualmatch = string.match(pattern);2732expectedmatch = Array('bbbac', 'a');2733addThis();2734status = inSection(421);2735pattern = /^(b+?|a){1,2}c/;2736string = 'bbbbac';2737actualmatch = string.match(pattern);2738expectedmatch = Array('bbbbac', 'a');2739addThis();2740status = inSection(422);2741pattern = /((?:aaaa|bbbb)cccc)?/;2742string = 'aaaacccc';2743actualmatch = string.match(pattern);2744expectedmatch = Array('aaaacccc', 'aaaacccc');2745addThis();2746status = inSection(423);2747pattern = /((?:aaaa|bbbb)cccc)?/;2748string = 'bbbbcccc';2749actualmatch = string.match(pattern);2750expectedmatch = Array('bbbbcccc', 'bbbbcccc');2751addThis();2752//-----------------------------------------------------------------------------2753test();2754//-----------------------------------------------------------------------------2755function addThis()2756{2757 if(omitCurrentSection())2758 return;2759 statusmessages[i] = status;2760 patterns[i] = pattern;2761 strings[i] = string;2762 actualmatches[i] = actualmatch;2763 expectedmatches[i] = expectedmatch;2764 i++;2765}2766function omitCurrentSection()2767{2768 try2769 {2770 // current section number is in global status variable2771 var n = status.match(/(\d+)/)[1];2772 return ((n < cnLBOUND) || (n > cnUBOUND));2773 }2774 catch(e)2775 {2776 return false;2777 }2778}2779function test()2780{2781 enterFunc ('test');2782 printBugNumber (bug);2783 printStatus (summary);2784 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);2785 exitFunc ('test');...

Full Screen

Full Screen

perlstress-002.js

Source:perlstress-002.js Github

copy

Full Screen

1/* ***** BEGIN LICENSE BLOCK *****2* Version: NPL 1.1/GPL 2.0/LGPL 2.13*4* The contents of this file are subject to the Netscape Public License5* Version 1.1 (the "License"); you may not use this file except in6* compliance with the License. You may obtain a copy of the License at7* http://www.mozilla.org/NPL/8*9* Software distributed under the License is distributed on an "AS IS" basis,10* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License11* for the specific language governing rights and limitations under the12* License.13*14* The Original Code is JavaScript Engine testing utilities.15*16* The Initial Developer of the Original Code is Netscape Communications Corp.17* Portions created by the Initial Developer are Copyright (C) 200218* the Initial Developer. All Rights Reserved.19*20* Contributor(s): pschwartau@netscape.com, rogerl@netscape.com21*22* Alternatively, the contents of this file may be used under the terms of23* either the GNU General Public License Version 2 or later (the "GPL"), or24* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),25* in which case the provisions of the GPL or the LGPL are applicable instead26* of those above. If you wish to allow use of your version of this file only27* under the terms of either the GPL or the LGPL, and not to allow others to28* use your version of this file under the terms of the NPL, indicate your29* decision by deleting the provisions above and replace them with the notice30* and other provisions required by the GPL or the LGPL. If you do not delete31* the provisions above, a recipient may use your version of this file under32* the terms of any one of the NPL, the GPL or the LGPL.33*34* ***** END LICENSE BLOCK *****35*36*37* Date: 2002-07-0738* SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine.39* Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested.40*41* This test was created by running various patterns and strings through the42* Perl 5 RegExp engine. We saved the results below to test the JS engine.43*44* Each of the examples below is a negative test; that is, each produces a45* null match in Perl. Thus we set |expectedmatch| = |null| in each section.46*47* NOTE: ECMA/JS and Perl do differ on certain points. We have either commented48* out such sections altogether, or modified them to fit what we expect from JS.49*50* EXAMPLES:51*52* - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc.53*54* - ECMA doesn't support (?(condition)55*56*/57//-----------------------------------------------------------------------------58var i = 0;59var bug = 85721;60var summary = 'Testing regular expression edge cases';61var cnSingleSpace = ' ';62var status = '';63var statusmessages = new Array();64var pattern = '';65var patterns = new Array();66var string = '';67var strings = new Array();68var actualmatch = '';69var actualmatches = new Array();70var expectedmatch = '';71var expectedmatches = new Array();72var cnLBOUND = 0;73var cnUBOUND = 1000;74status = inSection(1);75pattern = /abc/;76string = 'xbc';77actualmatch = string.match(pattern);78expectedmatch = null;79addThis();80status = inSection(2);81pattern = /abc/;82string = 'axc';83actualmatch = string.match(pattern);84expectedmatch = null;85addThis();86status = inSection(3);87pattern = /abc/;88string = 'abx';89actualmatch = string.match(pattern);90expectedmatch = null;91addThis();92status = inSection(4);93pattern = /ab+bc/;94string = 'abc';95actualmatch = string.match(pattern);96expectedmatch = null;97addThis();98status = inSection(5);99pattern = /ab+bc/;100string = 'abq';101actualmatch = string.match(pattern);102expectedmatch = null;103addThis();104status = inSection(6);105pattern = /ab{1,}bc/;106string = 'abq';107actualmatch = string.match(pattern);108expectedmatch = null;109addThis();110status = inSection(7);111pattern = /ab{4,5}bc/;112string = 'abbbbc';113actualmatch = string.match(pattern);114expectedmatch = null;115addThis();116status = inSection(8);117pattern = /ab?bc/;118string = 'abbbbc';119actualmatch = string.match(pattern);120expectedmatch = null;121addThis();122status = inSection(9);123pattern = /^abc$/;124string = 'abcc';125actualmatch = string.match(pattern);126expectedmatch = null;127addThis();128status = inSection(10);129pattern = /^abc$/;130string = 'aabc';131actualmatch = string.match(pattern);132expectedmatch = null;133addThis();134status = inSection(11);135pattern = /abc$/;136string = 'aabcd';137actualmatch = string.match(pattern);138expectedmatch = null;139addThis();140status = inSection(12);141pattern = /a.*c/;142string = 'axyzd';143actualmatch = string.match(pattern);144expectedmatch = null;145addThis();146status = inSection(13);147pattern = /a[bc]d/;148string = 'abc';149actualmatch = string.match(pattern);150expectedmatch = null;151addThis();152status = inSection(14);153pattern = /a[b-d]e/;154string = 'abd';155actualmatch = string.match(pattern);156expectedmatch = null;157addThis();158status = inSection(15);159pattern = /a[^bc]d/;160string = 'abd';161actualmatch = string.match(pattern);162expectedmatch = null;163addThis();164status = inSection(16);165pattern = /a[^-b]c/;166string = 'a-c';167actualmatch = string.match(pattern);168expectedmatch = null;169addThis();170status = inSection(17);171pattern = /a[^]b]c/;172string = 'a]c';173actualmatch = string.match(pattern);174expectedmatch = null;175addThis();176status = inSection(18);177pattern = /\by\b/;178string = 'xy';179actualmatch = string.match(pattern);180expectedmatch = null;181addThis();182status = inSection(19);183pattern = /\by\b/;184string = 'yz';185actualmatch = string.match(pattern);186expectedmatch = null;187addThis();188status = inSection(20);189pattern = /\by\b/;190string = 'xyz';191actualmatch = string.match(pattern);192expectedmatch = null;193addThis();194status = inSection(21);195pattern = /\Ba\B/;196string = 'a-';197actualmatch = string.match(pattern);198expectedmatch = null;199addThis();200status = inSection(22);201pattern = /\Ba\B/;202string = '-a';203actualmatch = string.match(pattern);204expectedmatch = null;205addThis();206status = inSection(23);207pattern = /\Ba\B/;208string = '-a-';209actualmatch = string.match(pattern);210expectedmatch = null;211addThis();212status = inSection(24);213pattern = /\w/;214string = '-';215actualmatch = string.match(pattern);216expectedmatch = null;217addThis();218status = inSection(25);219pattern = /\W/;220string = 'a';221actualmatch = string.match(pattern);222expectedmatch = null;223addThis();224status = inSection(26);225pattern = /a\sb/;226string = 'a-b';227actualmatch = string.match(pattern);228expectedmatch = null;229addThis();230status = inSection(27);231pattern = /\d/;232string = '-';233actualmatch = string.match(pattern);234expectedmatch = null;235addThis();236status = inSection(28);237pattern = /\D/;238string = '1';239actualmatch = string.match(pattern);240expectedmatch = null;241addThis();242status = inSection(29);243pattern = /[\w]/;244string = '-';245actualmatch = string.match(pattern);246expectedmatch = null;247addThis();248status = inSection(30);249pattern = /[\W]/;250string = 'a';251actualmatch = string.match(pattern);252expectedmatch = null;253addThis();254status = inSection(31);255pattern = /a[\s]b/;256string = 'a-b';257actualmatch = string.match(pattern);258expectedmatch = null;259addThis();260status = inSection(32);261pattern = /[\d]/;262string = '-';263actualmatch = string.match(pattern);264expectedmatch = null;265addThis();266status = inSection(33);267pattern = /[\D]/;268string = '1';269actualmatch = string.match(pattern);270expectedmatch = null;271addThis();272status = inSection(34);273pattern = /$b/;274string = 'b';275actualmatch = string.match(pattern);276expectedmatch = null;277addThis();278status = inSection(35);279pattern = /^(ab|cd)e/;280string = 'abcde';281actualmatch = string.match(pattern);282expectedmatch = null;283addThis();284status = inSection(36);285pattern = /a[bcd]+dcdcde/;286string = 'adcdcde';287actualmatch = string.match(pattern);288expectedmatch = null;289addThis();290status = inSection(37);291pattern = /(bc+d$|ef*g.|h?i(j|k))/;292string = 'effg';293actualmatch = string.match(pattern);294expectedmatch = null;295addThis();296status = inSection(38);297pattern = /(bc+d$|ef*g.|h?i(j|k))/;298string = 'bcdd';299actualmatch = string.match(pattern);300expectedmatch = null;301addThis();302status = inSection(39);303pattern = /[k]/;304string = 'ab';305actualmatch = string.match(pattern);306expectedmatch = null;307addThis();308// MODIFIED - ECMA has different rules for paren contents.309status = inSection(40);310pattern = /(a)|\1/;311string = 'x';312actualmatch = string.match(pattern);313//expectedmatch = null;314expectedmatch = Array("", undefined);315addThis();316// MODIFIED - ECMA has different rules for paren contents.317status = inSection(41);318pattern = /((\3|b)\2(a)x)+/;319string = 'aaxabxbaxbbx';320actualmatch = string.match(pattern);321//expectedmatch = null;322expectedmatch = Array("ax", "ax", "", "a");323addThis();324status = inSection(42);325pattern = /abc/i;326string = 'XBC';327actualmatch = string.match(pattern);328expectedmatch = null;329addThis();330status = inSection(43);331pattern = /abc/i;332string = 'AXC';333actualmatch = string.match(pattern);334expectedmatch = null;335addThis();336status = inSection(44);337pattern = /abc/i;338string = 'ABX';339actualmatch = string.match(pattern);340expectedmatch = null;341addThis();342status = inSection(45);343pattern = /ab+bc/i;344string = 'ABC';345actualmatch = string.match(pattern);346expectedmatch = null;347addThis();348status = inSection(46);349pattern = /ab+bc/i;350string = 'ABQ';351actualmatch = string.match(pattern);352expectedmatch = null;353addThis();354status = inSection(47);355pattern = /ab{1,}bc/i;356string = 'ABQ';357actualmatch = string.match(pattern);358expectedmatch = null;359addThis();360status = inSection(48);361pattern = /ab{4,5}?bc/i;362string = 'ABBBBC';363actualmatch = string.match(pattern);364expectedmatch = null;365addThis();366status = inSection(49);367pattern = /ab??bc/i;368string = 'ABBBBC';369actualmatch = string.match(pattern);370expectedmatch = null;371addThis();372status = inSection(50);373pattern = /^abc$/i;374string = 'ABCC';375actualmatch = string.match(pattern);376expectedmatch = null;377addThis();378status = inSection(51);379pattern = /^abc$/i;380string = 'AABC';381actualmatch = string.match(pattern);382expectedmatch = null;383addThis();384status = inSection(52);385pattern = /a.*c/i;386string = 'AXYZD';387actualmatch = string.match(pattern);388expectedmatch = null;389addThis();390status = inSection(53);391pattern = /a[bc]d/i;392string = 'ABC';393actualmatch = string.match(pattern);394expectedmatch = null;395addThis();396status = inSection(54);397pattern = /a[b-d]e/i;398string = 'ABD';399actualmatch = string.match(pattern);400expectedmatch = null;401addThis();402status = inSection(55);403pattern = /a[^bc]d/i;404string = 'ABD';405actualmatch = string.match(pattern);406expectedmatch = null;407addThis();408status = inSection(56);409pattern = /a[^-b]c/i;410string = 'A-C';411actualmatch = string.match(pattern);412expectedmatch = null;413addThis();414status = inSection(57);415pattern = /a[^]b]c/i;416string = 'A]C';417actualmatch = string.match(pattern);418expectedmatch = null;419addThis();420status = inSection(58);421pattern = /$b/i;422string = 'B';423actualmatch = string.match(pattern);424expectedmatch = null;425addThis();426status = inSection(59);427pattern = /^(ab|cd)e/i;428string = 'ABCDE';429actualmatch = string.match(pattern);430expectedmatch = null;431addThis();432status = inSection(60);433pattern = /a[bcd]+dcdcde/i;434string = 'ADCDCDE';435actualmatch = string.match(pattern);436expectedmatch = null;437addThis();438status = inSection(61);439pattern = /(bc+d$|ef*g.|h?i(j|k))/i;440string = 'EFFG';441actualmatch = string.match(pattern);442expectedmatch = null;443addThis();444status = inSection(62);445pattern = /(bc+d$|ef*g.|h?i(j|k))/i;446string = 'BCDD';447actualmatch = string.match(pattern);448expectedmatch = null;449addThis();450status = inSection(63);451pattern = /[k]/i;452string = 'AB';453actualmatch = string.match(pattern);454expectedmatch = null;455addThis();456status = inSection(64);457pattern = /^(a\1?){4}$/;458string = 'aaaaaaaaa';459actualmatch = string.match(pattern);460expectedmatch = null;461addThis();462status = inSection(65);463pattern = /^(a\1?){4}$/;464string = 'aaaaaaaaaaa';465actualmatch = string.match(pattern);466expectedmatch = null;467addThis();468/* ECMA doesn't support (?(469status = inSection(66);470pattern = /^(a(?(1)\1)){4}$/;471string = 'aaaaaaaaa';472actualmatch = string.match(pattern);473expectedmatch = null;474addThis();475status = inSection(67);476pattern = /^(a(?(1)\1)){4}$/;477string = 'aaaaaaaaaaa';478actualmatch = string.match(pattern);479expectedmatch = null;480addThis();481*/482/* ECMA doesn't support (?<483status = inSection(68);484pattern = /(?<=a)b/;485string = 'cb';486actualmatch = string.match(pattern);487expectedmatch = null;488addThis();489status = inSection(69);490pattern = /(?<=a)b/;491string = 'b';492actualmatch = string.match(pattern);493expectedmatch = null;494addThis();495status = inSection(70);496pattern = /(?<!c)b/;497string = 'cb';498actualmatch = string.match(pattern);499expectedmatch = null;500addThis();501*/502/* ECMA doesn't support (?(condition)503status = inSection(71);504pattern = /(?:(?i)a)b/;505string = 'aB';506actualmatch = string.match(pattern);507expectedmatch = null;508addThis();509status = inSection(72);510pattern = /((?i)a)b/;511string = 'aB';512actualmatch = string.match(pattern);513expectedmatch = null;514addThis();515status = inSection(73);516pattern = /(?i:a)b/;517string = 'aB';518actualmatch = string.match(pattern);519expectedmatch = null;520addThis();521status = inSection(74);522pattern = /((?i:a))b/;523string = 'aB';524actualmatch = string.match(pattern);525expectedmatch = null;526addThis();527status = inSection(75);528pattern = /(?:(?-i)a)b/i;529string = 'Ab';530actualmatch = string.match(pattern);531expectedmatch = null;532addThis();533status = inSection(76);534pattern = /((?-i)a)b/i;535string = 'Ab';536actualmatch = string.match(pattern);537expectedmatch = null;538addThis();539status = inSection(77);540pattern = /(?:(?-i)a)b/i;541string = 'AB';542actualmatch = string.match(pattern);543expectedmatch = null;544addThis();545status = inSection(78);546pattern = /((?-i)a)b/i;547string = 'AB';548actualmatch = string.match(pattern);549expectedmatch = null;550addThis();551status = inSection(79);552pattern = /(?-i:a)b/i;553string = 'Ab';554actualmatch = string.match(pattern);555expectedmatch = null;556addThis();557status = inSection(80);558pattern = /((?-i:a))b/i;559string = 'Ab';560actualmatch = string.match(pattern);561expectedmatch = null;562addThis();563status = inSection(81);564pattern = /(?-i:a)b/i;565string = 'AB';566actualmatch = string.match(pattern);567expectedmatch = null;568addThis();569status = inSection(82);570pattern = /((?-i:a))b/i;571string = 'AB';572actualmatch = string.match(pattern);573expectedmatch = null;574addThis();575status = inSection(83);576pattern = /((?-i:a.))b/i;577string = 'a\nB';578actualmatch = string.match(pattern);579expectedmatch = null;580addThis();581status = inSection(84);582pattern = /((?s-i:a.))b/i;583string = 'B\nB';584actualmatch = string.match(pattern);585expectedmatch = null;586addThis();587*/588/* ECMA doesn't support (?<589status = inSection(85);590pattern = /(?<![cd])b/;591string = 'dbcb';592actualmatch = string.match(pattern);593expectedmatch = null;594addThis();595status = inSection(86);596pattern = /(?<!(c|d))b/;597string = 'dbcb';598actualmatch = string.match(pattern);599expectedmatch = null;600addThis();601*/602status = inSection(87);603pattern = /^(?:a?b?)*$/;604string = 'a--';605actualmatch = string.match(pattern);606expectedmatch = null;607addThis();608status = inSection(88);609pattern = /^b/;610string = 'a\nb\nc\n';611actualmatch = string.match(pattern);612expectedmatch = null;613addThis();614status = inSection(89);615pattern = /()^b/;616string = 'a\nb\nc\n';617actualmatch = string.match(pattern);618expectedmatch = null;619addThis();620/* ECMA doesn't support (?(621status = inSection(90);622pattern = /(?(1)a|b)/;623string = 'a';624actualmatch = string.match(pattern);625expectedmatch = null;626addThis();627status = inSection(91);628pattern = /(x)?(?(1)a|b)/;629string = 'a';630actualmatch = string.match(pattern);631expectedmatch = null;632addThis();633status = inSection(92);634pattern = /()(?(1)b|a)/;635string = 'a';636actualmatch = string.match(pattern);637expectedmatch = null;638addThis();639status = inSection(93);640pattern = /^(\()?blah(?(1)(\)))$/;641string = 'blah)';642actualmatch = string.match(pattern);643expectedmatch = null;644addThis();645status = inSection(94);646pattern = /^(\()?blah(?(1)(\)))$/;647string = '(blah';648actualmatch = string.match(pattern);649expectedmatch = null;650addThis();651status = inSection(95);652pattern = /^(\(+)?blah(?(1)(\)))$/;653string = 'blah)';654actualmatch = string.match(pattern);655expectedmatch = null;656addThis();657status = inSection(96);658pattern = /^(\(+)?blah(?(1)(\)))$/;659string = '(blah';660actualmatch = string.match(pattern);661expectedmatch = null;662addThis();663status = inSection(97);664pattern = /(?(?{0})a|b)/;665string = 'a';666actualmatch = string.match(pattern);667expectedmatch = null;668addThis();669status = inSection(98);670pattern = /(?(?{1})b|a)/;671string = 'a';672actualmatch = string.match(pattern);673expectedmatch = null;674addThis();675status = inSection(99);676pattern = /(?(?!a)a|b)/;677string = 'a';678actualmatch = string.match(pattern);679expectedmatch = null;680addThis();681status = inSection(100);682pattern = /(?(?=a)b|a)/;683string = 'a';684actualmatch = string.match(pattern);685expectedmatch = null;686addThis();687*/688status = inSection(101);689pattern = /^(?=(a+?))\1ab/;690string = 'aaab';691actualmatch = string.match(pattern);692expectedmatch = null;693addThis();694status = inSection(102);695pattern = /^(?=(a+?))\1ab/;696string = 'aaab';697actualmatch = string.match(pattern);698expectedmatch = null;699addThis();700status = inSection(103);701pattern = /([\w:]+::)?(\w+)$/;702string = 'abcd:';703actualmatch = string.match(pattern);704expectedmatch = null;705addThis();706status = inSection(104);707pattern = /([\w:]+::)?(\w+)$/;708string = 'abcd:';709actualmatch = string.match(pattern);710expectedmatch = null;711addThis();712status = inSection(105);713pattern = /(>a+)ab/;714string = 'aaab';715actualmatch = string.match(pattern);716expectedmatch = null;717addThis();718status = inSection(106);719pattern = /a\Z/;720string = 'a\nb\n';721actualmatch = string.match(pattern);722expectedmatch = null;723addThis();724status = inSection(107);725pattern = /a\z/;726string = 'a\nb\n';727actualmatch = string.match(pattern);728expectedmatch = null;729addThis();730status = inSection(108);731pattern = /a$/;732string = 'a\nb\n';733actualmatch = string.match(pattern);734expectedmatch = null;735addThis();736status = inSection(109);737pattern = /a\z/;738string = 'b\na\n';739actualmatch = string.match(pattern);740expectedmatch = null;741addThis();742status = inSection(110);743pattern = /a\z/m;744string = 'a\nb\n';745actualmatch = string.match(pattern);746expectedmatch = null;747addThis();748status = inSection(111);749pattern = /a\z/m;750string = 'b\na\n';751actualmatch = string.match(pattern);752expectedmatch = null;753addThis();754status = inSection(112);755pattern = /aa\Z/;756string = 'aa\nb\n';757actualmatch = string.match(pattern);758expectedmatch = null;759addThis();760status = inSection(113);761pattern = /aa\z/;762string = 'aa\nb\n';763actualmatch = string.match(pattern);764expectedmatch = null;765addThis();766status = inSection(114);767pattern = /aa$/;768string = 'aa\nb\n';769actualmatch = string.match(pattern);770expectedmatch = null;771addThis();772status = inSection(115);773pattern = /aa\z/;774string = 'b\naa\n';775actualmatch = string.match(pattern);776expectedmatch = null;777addThis();778status = inSection(116);779pattern = /aa\z/m;780string = 'aa\nb\n';781actualmatch = string.match(pattern);782expectedmatch = null;783addThis();784status = inSection(117);785pattern = /aa\z/m;786string = 'b\naa\n';787actualmatch = string.match(pattern);788expectedmatch = null;789addThis();790status = inSection(118);791pattern = /aa\Z/;792string = 'ac\nb\n';793actualmatch = string.match(pattern);794expectedmatch = null;795addThis();796status = inSection(119);797pattern = /aa\z/;798string = 'ac\nb\n';799actualmatch = string.match(pattern);800expectedmatch = null;801addThis();802status = inSection(120);803pattern = /aa$/;804string = 'ac\nb\n';805actualmatch = string.match(pattern);806expectedmatch = null;807addThis();808status = inSection(121);809pattern = /aa\Z/;810string = 'b\nac\n';811actualmatch = string.match(pattern);812expectedmatch = null;813addThis();814status = inSection(122);815pattern = /aa\z/;816string = 'b\nac\n';817actualmatch = string.match(pattern);818expectedmatch = null;819addThis();820status = inSection(123);821pattern = /aa$/;822string = 'b\nac\n';823actualmatch = string.match(pattern);824expectedmatch = null;825addThis();826status = inSection(124);827pattern = /aa\Z/;828string = 'b\nac';829actualmatch = string.match(pattern);830expectedmatch = null;831addThis();832status = inSection(125);833pattern = /aa\z/;834string = 'b\nac';835actualmatch = string.match(pattern);836expectedmatch = null;837addThis();838status = inSection(126);839pattern = /aa$/;840string = 'b\nac';841actualmatch = string.match(pattern);842expectedmatch = null;843addThis();844status = inSection(127);845pattern = /aa\Z/m;846string = 'ac\nb\n';847actualmatch = string.match(pattern);848expectedmatch = null;849addThis();850status = inSection(128);851pattern = /aa\z/m;852string = 'ac\nb\n';853actualmatch = string.match(pattern);854expectedmatch = null;855addThis();856status = inSection(129);857pattern = /aa$/m;858string = 'ac\nb\n';859actualmatch = string.match(pattern);860expectedmatch = null;861addThis();862status = inSection(130);863pattern = /aa\Z/m;864string = 'b\nac\n';865actualmatch = string.match(pattern);866expectedmatch = null;867addThis();868status = inSection(131);869pattern = /aa\z/m;870string = 'b\nac\n';871actualmatch = string.match(pattern);872expectedmatch = null;873addThis();874status = inSection(132);875pattern = /aa$/m;876string = 'b\nac\n';877actualmatch = string.match(pattern);878expectedmatch = null;879addThis();880status = inSection(133);881pattern = /aa\Z/m;882string = 'b\nac';883actualmatch = string.match(pattern);884expectedmatch = null;885addThis();886status = inSection(134);887pattern = /aa\z/m;888string = 'b\nac';889actualmatch = string.match(pattern);890expectedmatch = null;891addThis();892status = inSection(135);893pattern = /aa$/m;894string = 'b\nac';895actualmatch = string.match(pattern);896expectedmatch = null;897addThis();898status = inSection(136);899pattern = /aa\Z/;900string = 'ca\nb\n';901actualmatch = string.match(pattern);902expectedmatch = null;903addThis();904status = inSection(137);905pattern = /aa\z/;906string = 'ca\nb\n';907actualmatch = string.match(pattern);908expectedmatch = null;909addThis();910status = inSection(138);911pattern = /aa$/;912string = 'ca\nb\n';913actualmatch = string.match(pattern);914expectedmatch = null;915addThis();916status = inSection(139);917pattern = /aa\Z/;918string = 'b\nca\n';919actualmatch = string.match(pattern);920expectedmatch = null;921addThis();922status = inSection(140);923pattern = /aa\z/;924string = 'b\nca\n';925actualmatch = string.match(pattern);926expectedmatch = null;927addThis();928status = inSection(141);929pattern = /aa$/;930string = 'b\nca\n';931actualmatch = string.match(pattern);932expectedmatch = null;933addThis();934status = inSection(142);935pattern = /aa\Z/;936string = 'b\nca';937actualmatch = string.match(pattern);938expectedmatch = null;939addThis();940status = inSection(143);941pattern = /aa\z/;942string = 'b\nca';943actualmatch = string.match(pattern);944expectedmatch = null;945addThis();946status = inSection(144);947pattern = /aa$/;948string = 'b\nca';949actualmatch = string.match(pattern);950expectedmatch = null;951addThis();952status = inSection(145);953pattern = /aa\Z/m;954string = 'ca\nb\n';955actualmatch = string.match(pattern);956expectedmatch = null;957addThis();958status = inSection(146);959pattern = /aa\z/m;960string = 'ca\nb\n';961actualmatch = string.match(pattern);962expectedmatch = null;963addThis();964status = inSection(147);965pattern = /aa$/m;966string = 'ca\nb\n';967actualmatch = string.match(pattern);968expectedmatch = null;969addThis();970status = inSection(148);971pattern = /aa\Z/m;972string = 'b\nca\n';973actualmatch = string.match(pattern);974expectedmatch = null;975addThis();976status = inSection(149);977pattern = /aa\z/m;978string = 'b\nca\n';979actualmatch = string.match(pattern);980expectedmatch = null;981addThis();982status = inSection(150);983pattern = /aa$/m;984string = 'b\nca\n';985actualmatch = string.match(pattern);986expectedmatch = null;987addThis();988status = inSection(151);989pattern = /aa\Z/m;990string = 'b\nca';991actualmatch = string.match(pattern);992expectedmatch = null;993addThis();994status = inSection(152);995pattern = /aa\z/m;996string = 'b\nca';997actualmatch = string.match(pattern);998expectedmatch = null;999addThis();1000status = inSection(153);1001pattern = /aa$/m;1002string = 'b\nca';1003actualmatch = string.match(pattern);1004expectedmatch = null;1005addThis();1006status = inSection(154);1007pattern = /ab\Z/;1008string = 'ab\nb\n';1009actualmatch = string.match(pattern);1010expectedmatch = null;1011addThis();1012status = inSection(155);1013pattern = /ab\z/;1014string = 'ab\nb\n';1015actualmatch = string.match(pattern);1016expectedmatch = null;1017addThis();1018status = inSection(156);1019pattern = /ab$/;1020string = 'ab\nb\n';1021actualmatch = string.match(pattern);1022expectedmatch = null;1023addThis();1024status = inSection(157);1025pattern = /ab\z/;1026string = 'b\nab\n';1027actualmatch = string.match(pattern);1028expectedmatch = null;1029addThis();1030status = inSection(158);1031pattern = /ab\z/m;1032string = 'ab\nb\n';1033actualmatch = string.match(pattern);1034expectedmatch = null;1035addThis();1036status = inSection(159);1037pattern = /ab\z/m;1038string = 'b\nab\n';1039actualmatch = string.match(pattern);1040expectedmatch = null;1041addThis();1042status = inSection(160);1043pattern = /ab\Z/;1044string = 'ac\nb\n';1045actualmatch = string.match(pattern);1046expectedmatch = null;1047addThis();1048status = inSection(161);1049pattern = /ab\z/;1050string = 'ac\nb\n';1051actualmatch = string.match(pattern);1052expectedmatch = null;1053addThis();1054status = inSection(162);1055pattern = /ab$/;1056string = 'ac\nb\n';1057actualmatch = string.match(pattern);1058expectedmatch = null;1059addThis();1060status = inSection(163);1061pattern = /ab\Z/;1062string = 'b\nac\n';1063actualmatch = string.match(pattern);1064expectedmatch = null;1065addThis();1066status = inSection(164);1067pattern = /ab\z/;1068string = 'b\nac\n';1069actualmatch = string.match(pattern);1070expectedmatch = null;1071addThis();1072status = inSection(165);1073pattern = /ab$/;1074string = 'b\nac\n';1075actualmatch = string.match(pattern);1076expectedmatch = null;1077addThis();1078status = inSection(166);1079pattern = /ab\Z/;1080string = 'b\nac';1081actualmatch = string.match(pattern);1082expectedmatch = null;1083addThis();1084status = inSection(167);1085pattern = /ab\z/;1086string = 'b\nac';1087actualmatch = string.match(pattern);1088expectedmatch = null;1089addThis();1090status = inSection(168);1091pattern = /ab$/;1092string = 'b\nac';1093actualmatch = string.match(pattern);1094expectedmatch = null;1095addThis();1096status = inSection(169);1097pattern = /ab\Z/m;1098string = 'ac\nb\n';1099actualmatch = string.match(pattern);1100expectedmatch = null;1101addThis();1102status = inSection(170);1103pattern = /ab\z/m;1104string = 'ac\nb\n';1105actualmatch = string.match(pattern);1106expectedmatch = null;1107addThis();1108status = inSection(171);1109pattern = /ab$/m;1110string = 'ac\nb\n';1111actualmatch = string.match(pattern);1112expectedmatch = null;1113addThis();1114status = inSection(172);1115pattern = /ab\Z/m;1116string = 'b\nac\n';1117actualmatch = string.match(pattern);1118expectedmatch = null;1119addThis();1120status = inSection(173);1121pattern = /ab\z/m;1122string = 'b\nac\n';1123actualmatch = string.match(pattern);1124expectedmatch = null;1125addThis();1126status = inSection(174);1127pattern = /ab$/m;1128string = 'b\nac\n';1129actualmatch = string.match(pattern);1130expectedmatch = null;1131addThis();1132status = inSection(175);1133pattern = /ab\Z/m;1134string = 'b\nac';1135actualmatch = string.match(pattern);1136expectedmatch = null;1137addThis();1138status = inSection(176);1139pattern = /ab\z/m;1140string = 'b\nac';1141actualmatch = string.match(pattern);1142expectedmatch = null;1143addThis();1144status = inSection(177);1145pattern = /ab$/m;1146string = 'b\nac';1147actualmatch = string.match(pattern);1148expectedmatch = null;1149addThis();1150status = inSection(178);1151pattern = /ab\Z/;1152string = 'ca\nb\n';1153actualmatch = string.match(pattern);1154expectedmatch = null;1155addThis();1156status = inSection(179);1157pattern = /ab\z/;1158string = 'ca\nb\n';1159actualmatch = string.match(pattern);1160expectedmatch = null;1161addThis();1162status = inSection(180);1163pattern = /ab$/;1164string = 'ca\nb\n';1165actualmatch = string.match(pattern);1166expectedmatch = null;1167addThis();1168status = inSection(181);1169pattern = /ab\Z/;1170string = 'b\nca\n';1171actualmatch = string.match(pattern);1172expectedmatch = null;1173addThis();1174status = inSection(182);1175pattern = /ab\z/;1176string = 'b\nca\n';1177actualmatch = string.match(pattern);1178expectedmatch = null;1179addThis();1180status = inSection(183);1181pattern = /ab$/;1182string = 'b\nca\n';1183actualmatch = string.match(pattern);1184expectedmatch = null;1185addThis();1186status = inSection(184);1187pattern = /ab\Z/;1188string = 'b\nca';1189actualmatch = string.match(pattern);1190expectedmatch = null;1191addThis();1192status = inSection(185);1193pattern = /ab\z/;1194string = 'b\nca';1195actualmatch = string.match(pattern);1196expectedmatch = null;1197addThis();1198status = inSection(186);1199pattern = /ab$/;1200string = 'b\nca';1201actualmatch = string.match(pattern);1202expectedmatch = null;1203addThis();1204status = inSection(187);1205pattern = /ab\Z/m;1206string = 'ca\nb\n';1207actualmatch = string.match(pattern);1208expectedmatch = null;1209addThis();1210status = inSection(188);1211pattern = /ab\z/m;1212string = 'ca\nb\n';1213actualmatch = string.match(pattern);1214expectedmatch = null;1215addThis();1216status = inSection(189);1217pattern = /ab$/m;1218string = 'ca\nb\n';1219actualmatch = string.match(pattern);1220expectedmatch = null;1221addThis();1222status = inSection(190);1223pattern = /ab\Z/m;1224string = 'b\nca\n';1225actualmatch = string.match(pattern);1226expectedmatch = null;1227addThis();1228status = inSection(191);1229pattern = /ab\z/m;1230string = 'b\nca\n';1231actualmatch = string.match(pattern);1232expectedmatch = null;1233addThis();1234status = inSection(192);1235pattern = /ab$/m;1236string = 'b\nca\n';1237actualmatch = string.match(pattern);1238expectedmatch = null;1239addThis();1240status = inSection(193);1241pattern = /ab\Z/m;1242string = 'b\nca';1243actualmatch = string.match(pattern);1244expectedmatch = null;1245addThis();1246status = inSection(194);1247pattern = /ab\z/m;1248string = 'b\nca';1249actualmatch = string.match(pattern);1250expectedmatch = null;1251addThis();1252status = inSection(195);1253pattern = /ab$/m;1254string = 'b\nca';1255actualmatch = string.match(pattern);1256expectedmatch = null;1257addThis();1258status = inSection(196);1259pattern = /abb\Z/;1260string = 'abb\nb\n';1261actualmatch = string.match(pattern);1262expectedmatch = null;1263addThis();1264status = inSection(197);1265pattern = /abb\z/;1266string = 'abb\nb\n';1267actualmatch = string.match(pattern);1268expectedmatch = null;1269addThis();1270status = inSection(198);1271pattern = /abb$/;1272string = 'abb\nb\n';1273actualmatch = string.match(pattern);1274expectedmatch = null;1275addThis();1276status = inSection(199);1277pattern = /abb\z/;1278string = 'b\nabb\n';1279actualmatch = string.match(pattern);1280expectedmatch = null;1281addThis();1282status = inSection(200);1283pattern = /abb\z/m;1284string = 'abb\nb\n';1285actualmatch = string.match(pattern);1286expectedmatch = null;1287addThis();1288status = inSection(201);1289pattern = /abb\z/m;1290string = 'b\nabb\n';1291actualmatch = string.match(pattern);1292expectedmatch = null;1293addThis();1294status = inSection(202);1295pattern = /abb\Z/;1296string = 'ac\nb\n';1297actualmatch = string.match(pattern);1298expectedmatch = null;1299addThis();1300status = inSection(203);1301pattern = /abb\z/;1302string = 'ac\nb\n';1303actualmatch = string.match(pattern);1304expectedmatch = null;1305addThis();1306status = inSection(204);1307pattern = /abb$/;1308string = 'ac\nb\n';1309actualmatch = string.match(pattern);1310expectedmatch = null;1311addThis();1312status = inSection(205);1313pattern = /abb\Z/;1314string = 'b\nac\n';1315actualmatch = string.match(pattern);1316expectedmatch = null;1317addThis();1318status = inSection(206);1319pattern = /abb\z/;1320string = 'b\nac\n';1321actualmatch = string.match(pattern);1322expectedmatch = null;1323addThis();1324status = inSection(207);1325pattern = /abb$/;1326string = 'b\nac\n';1327actualmatch = string.match(pattern);1328expectedmatch = null;1329addThis();1330status = inSection(208);1331pattern = /abb\Z/;1332string = 'b\nac';1333actualmatch = string.match(pattern);1334expectedmatch = null;1335addThis();1336status = inSection(209);1337pattern = /abb\z/;1338string = 'b\nac';1339actualmatch = string.match(pattern);1340expectedmatch = null;1341addThis();1342status = inSection(210);1343pattern = /abb$/;1344string = 'b\nac';1345actualmatch = string.match(pattern);1346expectedmatch = null;1347addThis();1348status = inSection(211);1349pattern = /abb\Z/m;1350string = 'ac\nb\n';1351actualmatch = string.match(pattern);1352expectedmatch = null;1353addThis();1354status = inSection(212);1355pattern = /abb\z/m;1356string = 'ac\nb\n';1357actualmatch = string.match(pattern);1358expectedmatch = null;1359addThis();1360status = inSection(213);1361pattern = /abb$/m;1362string = 'ac\nb\n';1363actualmatch = string.match(pattern);1364expectedmatch = null;1365addThis();1366status = inSection(214);1367pattern = /abb\Z/m;1368string = 'b\nac\n';1369actualmatch = string.match(pattern);1370expectedmatch = null;1371addThis();1372status = inSection(215);1373pattern = /abb\z/m;1374string = 'b\nac\n';1375actualmatch = string.match(pattern);1376expectedmatch = null;1377addThis();1378status = inSection(216);1379pattern = /abb$/m;1380string = 'b\nac\n';1381actualmatch = string.match(pattern);1382expectedmatch = null;1383addThis();1384status = inSection(217);1385pattern = /abb\Z/m;1386string = 'b\nac';1387actualmatch = string.match(pattern);1388expectedmatch = null;1389addThis();1390status = inSection(218);1391pattern = /abb\z/m;1392string = 'b\nac';1393actualmatch = string.match(pattern);1394expectedmatch = null;1395addThis();1396status = inSection(219);1397pattern = /abb$/m;1398string = 'b\nac';1399actualmatch = string.match(pattern);1400expectedmatch = null;1401addThis();1402status = inSection(220);1403pattern = /abb\Z/;1404string = 'ca\nb\n';1405actualmatch = string.match(pattern);1406expectedmatch = null;1407addThis();1408status = inSection(221);1409pattern = /abb\z/;1410string = 'ca\nb\n';1411actualmatch = string.match(pattern);1412expectedmatch = null;1413addThis();1414status = inSection(222);1415pattern = /abb$/;1416string = 'ca\nb\n';1417actualmatch = string.match(pattern);1418expectedmatch = null;1419addThis();1420status = inSection(223);1421pattern = /abb\Z/;1422string = 'b\nca\n';1423actualmatch = string.match(pattern);1424expectedmatch = null;1425addThis();1426status = inSection(224);1427pattern = /abb\z/;1428string = 'b\nca\n';1429actualmatch = string.match(pattern);1430expectedmatch = null;1431addThis();1432status = inSection(225);1433pattern = /abb$/;1434string = 'b\nca\n';1435actualmatch = string.match(pattern);1436expectedmatch = null;1437addThis();1438status = inSection(226);1439pattern = /abb\Z/;1440string = 'b\nca';1441actualmatch = string.match(pattern);1442expectedmatch = null;1443addThis();1444status = inSection(227);1445pattern = /abb\z/;1446string = 'b\nca';1447actualmatch = string.match(pattern);1448expectedmatch = null;1449addThis();1450status = inSection(228);1451pattern = /abb$/;1452string = 'b\nca';1453actualmatch = string.match(pattern);1454expectedmatch = null;1455addThis();1456status = inSection(229);1457pattern = /abb\Z/m;1458string = 'ca\nb\n';1459actualmatch = string.match(pattern);1460expectedmatch = null;1461addThis();1462status = inSection(230);1463pattern = /abb\z/m;1464string = 'ca\nb\n';1465actualmatch = string.match(pattern);1466expectedmatch = null;1467addThis();1468status = inSection(231);1469pattern = /abb$/m;1470string = 'ca\nb\n';1471actualmatch = string.match(pattern);1472expectedmatch = null;1473addThis();1474status = inSection(232);1475pattern = /abb\Z/m;1476string = 'b\nca\n';1477actualmatch = string.match(pattern);1478expectedmatch = null;1479addThis();1480status = inSection(233);1481pattern = /abb\z/m;1482string = 'b\nca\n';1483actualmatch = string.match(pattern);1484expectedmatch = null;1485addThis();1486status = inSection(234);1487pattern = /abb$/m;1488string = 'b\nca\n';1489actualmatch = string.match(pattern);1490expectedmatch = null;1491addThis();1492status = inSection(235);1493pattern = /abb\Z/m;1494string = 'b\nca';1495actualmatch = string.match(pattern);1496expectedmatch = null;1497addThis();1498status = inSection(236);1499pattern = /abb\z/m;1500string = 'b\nca';1501actualmatch = string.match(pattern);1502expectedmatch = null;1503addThis();1504status = inSection(237);1505pattern = /abb$/m;1506string = 'b\nca';1507actualmatch = string.match(pattern);1508expectedmatch = null;1509addThis();1510status = inSection(238);1511pattern = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/;1512string = 'x';1513actualmatch = string.match(pattern);1514expectedmatch = null;1515addThis();1516status = inSection(239);1517pattern = /\GX.*X/;1518string = 'aaaXbX';1519actualmatch = string.match(pattern);1520expectedmatch = null;1521addThis();1522status = inSection(240);1523pattern = /\.c(pp|xx|c)?$/i;1524string = 'Changes';1525actualmatch = string.match(pattern);1526expectedmatch = null;1527addThis();1528status = inSection(241);1529pattern = /^([a-z]:)/;1530string = 'C:/';1531actualmatch = string.match(pattern);1532expectedmatch = null;1533addThis();1534status = inSection(242);1535pattern = /(\w)?(abc)\1b/;1536string = 'abcab';1537actualmatch = string.match(pattern);1538expectedmatch = null;1539addThis();1540/* ECMA doesn't support (?(1541status = inSection(243);1542pattern = /^(a)?(?(1)a|b)+$/;1543string = 'a';1544actualmatch = string.match(pattern);1545expectedmatch = null;1546addThis();1547*/1548//-----------------------------------------------------------------------------1549test();1550//-----------------------------------------------------------------------------1551function addThis()1552{1553 if(omitCurrentSection())1554 return;1555 statusmessages[i] = status;1556 patterns[i] = pattern;1557 strings[i] = string;1558 actualmatches[i] = actualmatch;1559 expectedmatches[i] = expectedmatch;1560 i++;1561}1562function omitCurrentSection()1563{1564 try1565 {1566 // current section number is in global status variable1567 var n = status.match(/(\d+)/)[1];1568 return ((n < cnLBOUND) || (n > cnUBOUND));1569 }1570 catch(e)1571 {1572 return false;1573 }1574}1575function test()1576{1577 enterFunc ('test');1578 printBugNumber (bug);1579 printStatus (summary);1580 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);1581 exitFunc ('test');...

Full Screen

Full Screen

user.controller.js

Source:user.controller.js Github

copy

Full Screen

...24 }25});26const Op = Sequelize.Op;27exports.allAccess = (req, res) => {28 res.status(200).send("Public Content.");29 };30exports.userBoard = (req, res) => {31 res.status(200).send("User Content.");32};33exports.adminBoard = (req, res) => {34 res.status(200).send("Admin Content.");35};36exports.moderatorBoard = (req, res) => {37 res.status(200).send("Moderator Content.");38};39exports.userAll = (req, res) => {40 User.findAll({41 where: {42 admin: '0'43 }44 })45 .then(users => {46 res.status(200).send(users)47 })48 .catch(err => {49 res.status(500).send([])50 });51}52exports.adminAll = (req, res) => {53 User.findAll({54 where: {55 admin: '1'56 }57 })58 .then(users => {59 res.status(200).send(users)60 })61 .catch(err => {62 res.status(500).send([])63 });64}65exports.userActiveAll = (req, res) => {66 User.findAll({67 where: {68 admin: '0',69 active: 'YES'70 }71 })72 .then(users => {73 res.status(200).send(users)74 })75 .catch(err => {76 res.status(500).send([])77 });78}79exports.userDeactiveAll = (req, res) => {80 User.findAll({81 where: {82 admin: '0',83 active: 'NO'84 }85 })86 .then(users => {87 res.status(200).send(users)88 })89 .catch(err => {90 res.status(500).send([])91 });92}93exports.userOne = (req, res) => {94 User.findOne({95 where: {96 id: req.body.id97 }98 })99 .then(user => {100 res.status(200).send(user)101 })102 .catch(err => {103 res.status(500).send({})104 });105}106exports.update = (req, res) => {107 let user = req.body;108 let id = req.body.id;109 delete user.id;110 delete user.updatedAt;111 if(user.password)112 user.password = bcrypt.hashSync(user.password, 8);113 User.update(114 user,115 {where: {id: id}}116 )117 .then(user => {118 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });119 })120 .catch(err => {121 return res.status(500).send({ status:'fail', message: err.message });122 });123}124exports.updatePassword = (req, res) => {125 User.findOne({126 where: {127 id: req.body.id128 }129 }).then(user => {130 if (!user) {131 return res.status(404).send({ message: "Usuário não encontrado." });132 }133 var passwordIsValid = bcrypt.compareSync(134 req.body.current_password,135 user.password136 );137 console.log(passwordIsValid);138 if (!passwordIsValid) {139 return res.status(401).send({ status:'fail', message: "Senha inválida!" });140 }141 User.update(142 {password: bcrypt.hashSync(req.body.password, 8)},143 {where: {id: req.body.id}}144 )145 .then(user => {146 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });147 })148 .catch(err => {149 return res.status(500).send({ status:'fail', message: err.message });150 });151 })152 .catch(err => {153 res.status(500).send({ message: err.message });154 });155}156exports.delete = (req, res) => {157 console.log(req.body)158 User.destroy(159 {where: {id: req.body.id}}160 )161 .then(user => {162 Deposit.destroy(163 {where: {user_id: req.body.id}}164 )165 Withdraw.destroy(166 {where: {user_id: req.body.id}}167 )168 Contract_history.destroy(169 {where: {user_id: req.body.id}}170 )171 Contract.destroy(172 {where: {user_id: req.body.id}}173 )174 Case.destroy(175 {where: {user_id: req.body.id}}176 )177 Contract_pdf.destroy(178 {where: {user_id: req.body.id}}179 )180 Case_deposit.destroy(181 {where: {user_id: req.body.id}}182 )183 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });184 })185 .catch(err => {186 return res.status(500).send({ status:'fail', message: err.message });187 });188}189exports.setActive = (req, res) => {190 let upload = multer({ storage: storage,limits:{fileSize:'10mb'}, fileFilter: multerHelper.pdfFilter}).single('admin_pdf');191 upload(req, res, function(err) {192 if (req.fileValidationError) {193 return res.status(200).send({ status:'fail', message: req.fileValidationError });194 }195 else if (!req.file) {196 User.update(197 {198 active: req.body.active,199 },200 {where: {id: req.body.userId}}201 )202 .then(user => {203 let now = moment();204 Contract.create(205 {206 user_id: req.body.userId,207 open_value: req.body.investment,208 invest_type: req.body.investment_type,209 start_date: now.format("YYYY-MM-DD"),210 status: 'processando',211 percent: req.body.investment_type === 'FLEXIVEL' ? constant_config.FLEX_DEFAULT_PERCENT: constant_config.CRESC_DEFAULT_PERCENT,212 end_date: req.body.investment_type === 'FLEXIVEL' ? moment(now.format("YYYY-MM-DD")).add(1, 'M') : moment(now.format("YYYY-MM-DD")).add(8, 'M')213 }214 )215 .then(res_data => {216 Contract_history.create(217 {218 user_id: res_data.user_id,219 value: res_data.open_value,220 contract_id: res_data.id,221 action_type: 0,222 invest_type: res_data.invest_type223 }224 )225 let contract_pdf_create = {226 user_id: req.body.userId,227 invest_type: req.body.investment_type,228 }229 if (req.body.investment_type === 'FLEXIVEL') {230 Contract_pdf.create(contract_pdf_create)231 } else if (req.body.investment_type === 'CRESCIMENTO') {232 Contract_percent.create({233 contract_id: res_data.id,234 percent: constant_config.CRESC_DEFAULT_PERCENT235 })236 contract_pdf_create = {237 user_id: req.body.userId,238 invest_type: req.body.investment_type,239 contract_id: res_data.id240 }241 Contract_pdf.create(contract_pdf_create)242 }243 Case.count({244 where: {user_id: req.body.userId}}).then(count => {245 if( count === 0 ) {246 Case.create({user_id: req.body.userId, balance: 0}).then(create_case => {247 console.log(create_case)248 })249 }250 })251 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });252 })253 .catch(err => {254 return res.status(200).send({ status:'fail', message: err.message });255 });256 })257 .catch(err => {258 return res.status(200).send({ status:'fail', message: err.message });259 });260 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });261 }262 else if (err instanceof multer.MulterError) {263 return res.status(200).send({ status:'fail', message: err });264 }265 else if (err) {266 return res.status(200).send({ status:'fail', message: err });267 }else if (req.file) {268 User.update(269 {270 active: req.body.active,271 },272 { where: { id: req.body.userId } }273 )274 .then(user => {275 let now = moment();276 Contract.create(277 {278 user_id: req.body.userId,279 open_value: req.body.investment,280 invest_type: req.body.investment_type,281 start_date: now.format("YYYY-MM-DD"),282 status: 'processando',283 percent: req.body.investment_type === 'FLEXIVEL' ? constant_config.FLEX_DEFAULT_PERCENT: constant_config.CRESC_DEFAULT_PERCENT,284 end_date: req.body.investment_type == 'FLEXIVEL' ? moment(now.format("YYYY-MM-DD")).add(1, 'M') : moment(now.format("YYYY-MM-DD")).add(8, 'M')285 }286 )287 .then(res_data => {288 Contract_history.create(289 {290 user_id: res_data.user_id,291 value: res_data.open_value,292 contract_id: res_data.id,293 action_type: 0,294 invest_type: res_data.invest_type295 }296 )297 let contract_pdf_create = {298 user_id: req.body.userId,299 admin_pdf: req.file.path,300 invest_type: req.body.investment_type,301 }302 if (req.body.investment_type === 'FLEXIVEL') {303 contract_pdf_create = {304 user_id: req.body.userId,305 admin_pdf: req.file.path,306 invest_type: req.body.investment_type,307 }308 } else if (req.body.investment_type === 'CRESCIMENTO') {309 Contract_percent.create({310 contract_id: res_data.id,311 percent: constant_config.CRESC_DEFAULT_PERCENT312 })313 contract_pdf_create = {314 user_id: req.body.userId,315 admin_pdf2: req.file.path,316 invest_type: req.body.investment_type,317 contract_id: res_data.id318 }319 }320 Contract_pdf.create(contract_pdf_create)321 Case.count({322 where: { user_id: req.body.userId }323 }).then(count => {324 if (count == 0) {325 Case.create({ user_id: req.body.userId, balance: 0 }).then(create_case => {326 console.log(create_case)327 })328 }329 })330 return res.status(200).send({ status: 'success', message: "Ação realizada com sucesso!" });331 })332 .catch(err => {333 return res.status(200).send({ status: 'fail', message: err.message });334 });335 })336 .catch(err => {337 return res.status(200).send({ status: 'fail', message: err.message });338 });339 }340 })341}342exports.userBank = (req, res) => {343 Bank.findOne({344 include: [{345 model: Bank_list, User346 }],347 where: {348 user_id: req.body.user_id349 }350 })351 .then(bank => {352 res.status(200).send(bank)353 })354 .catch(err => {355 res.status(500).send({})356 });357}358exports.bankUpdate = (req, res) => {359 let bank = req.body;360 Bank.findOne({361 where: {362 user_id: req.body.user_id363 }364 })365 .then(res_data => {366 if(!res_data) {367 Bank.create(368 bank369 )370 .then(res_data => {371 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });372 })373 .catch(err => {374 return res.status(500).send({ status:'fail', message: err.message });375 });376 } else {377 let user_id = req.body.user_id;378 delete bank.user_id;379 delete bank.updatedAt;380 Bank.update(381 bank,382 {where: {user_id: user_id}}383 )384 .then(res_data => {385 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });386 })387 .catch(err => {388 return res.status(500).send({ status:'fail', message: err.message });389 });390 }391 }).catch(err => {392 return res.status(500).send({ status:'fail', message: err.message });393 });394}395exports.getBalance = (req, res) => {396 let now = moment();397 console.log('-----------get balance-------------')398 if(moment().isBetween(now.date(2).format("YYYY-MM-DD"), now.endOf('month').format("YYYY-MM-DD"))) {399 console.log('-----------get balance-------------')400 Case.findOne({401 include: [{402 model: User,403 }],404 where: {405 user_id: req.body.user_id406 }407 })408 .then(data => {409 console.log('-----------get balance-------------')410 console.log(data)411 res.status(200).send(data)412 })413 .catch(err => {414 res.status(200).send({status: 'fail', message: "Você não tem saldo suficiente"})415 });416 }else {417 console.log('-----------get balance-------------')418 res.status(200).send({status: 'fail', title: 'Saque', message: 'O saque ficará disponível entre os dias 25 e 30 de cada mês.'})419 }420}421exports.contract_all = (req, res) => {422 Contract_pdf.findAll({423 include: [424 {425 model: User,426 attributes: ['id', 'cpf', 'email', 'full_name'],427 },428 {429 model: Contract430 }431 ],432 where: req.body433 })434 .then(users => {435 res.status(200).send(users)436 })437 .catch(err => {438 res.status(500).send([])439 });440}441exports.contract_by_user = (req, res) => {442 Contract_pdf.findOne({443 where: {444 user_id: req.body.user_id445 }446 })447 .then(data => {448 res.status(200).send(data)449 })450 .catch(err => {451 res.status(500).send(null)452 });453}454exports.download_contract = (req, res) => {455 const filepath = req.body.pdf_path;456 res.download(filepath, "contract.pdf")457}458exports.admin_upload_contract = (req, res) => {459 let upload = multer({ storage: storage,limits:{fileSize:'10mb'}, fileFilter: multerHelper.pdfFilter}).single('admin_pdf');460 upload(req, res, function(err) {461 if (req.fileValidationError) {462 return res.status(200).send({ status:'fail', message: req.fileValidationError });463 }464 else if (!req.file) {465 return res.status(200).send({ status:'fail', message: 'please select file' });466 }467 else if (err instanceof multer.MulterError) {468 return res.status(200).send({ status:'fail', message: err });469 }470 else if (err) {471 return res.status(200).send({ status:'fail', message: err });472 }473 let update_data = {474 user_id: req.body.userId,475 admin_pdf: req.file.path476 }477 if(req.body.pdf_field == "admin_pdf") {478 update_data = {479 user_id: req.body.userId,480 admin_pdf: req.file.path481 }482 }else if(req.body.pdf_field == 'admin_pdf2'){483 update_data = {484 user_id: req.body.userId,485 admin_pdf2: req.file.path486 }487 }488 Contract_pdf.update(489 update_data,490 {where: {contract_id: req.body.id}}491 )492 .then(res_data => {493 return res.status(200).send({ status:'success', message: "upload success" });494 })495 .catch(err => {496 return res.status(200).send({ status:'fail', message: "upload fail" });497 });498 })499}500exports.user_upload_contract = (req, res) => {501 let upload = multer({ storage: storage,limits:{fileSize:'10mb'}, fileFilter: multerHelper.pdfFilter}).single('user_pdf');502 upload(req, res, function(err) {503 if (req.fileValidationError) {504 return res.status(200).send({ status:'fail', message: req.fileValidationError });505 }506 else if (!req.file) {507 return res.status(200).send({ status:'fail', message: 'please select file' });508 }509 else if (err instanceof multer.MulterError) {510 return res.status(200).send({ status:'fail', message: err });511 }512 else if (err) {513 return res.status(200).send({ status:'fail', message: err });514 }515 let update_data = {516 user_pdf: req.file.path517 }518 let where_con = {user_id: req.userId}519 if(req.body.pdf_field == "user_pdf") {520 update_data = {521 user_pdf: req.file.path522 }523 }else if(req.body.pdf_field == 'user_pdf2'){524 update_data = {525 user_pdf2: req.file.path526 }527 where_con = {user_id: req.userId, contract_id: req.body.contract_id}528 }529 Contract_pdf.update(530 update_data,531 {where: where_con}532 )533 .then(res_data => {534 return res.status(200).send({ status:'success', message: "upload success" });535 })536 .catch(err => {537 return res.status(200).send({ status:'fail', message: "upload fail" });538 });539 })540}541exports.download_user_contract = (req, res) => {542 Contract_pdf.findOne({where: {user_id: req.userId}}).then(data => {543 let filepath = data.admin_pdf544 if(req.body.invest_type == 'CRESCIMENTO') {545 filepath = data.admin_pdf2546 }else if(req.body.invest_type == 'FLEXIVEL') {547 filepath = data.admin_pdf548 }549 res.download(filepath, "contract.pdf")550 })551}552exports.download_user_contract_by_cp = (req, res) => {553 Contract_pdf.findOne({where: {id: req.body.contract_pdf_id}}).then(data => {554 const filepath = data.admin_pdf2555 res.download(filepath, "contract.pdf")556 })557}558exports.check_cpf_user = (req, res) => {559 User.findOne({where: {cpf: req.body.cpf, active: 'YES'}}).then(data => {560 return res.status(200).send({cpf_user: data})561 }).catch(err => {562 return res.status(200).send({cpf_user: null});563 });564}565exports.bank_all = (req, res) => {566 Bank_list.findAll()567 .then(datas => {568 res.status(200).send(datas)569 })570 .catch(err => {571 res.status(500).send([])572 });573}574exports.all_case_deposit = (req, res) => {575 Case_deposit.findAll({include: [User]})576 .then(datas => {577 res.status(200).send(datas)578 })579 .catch(err => {580 res.status(500).send([])581 });582}583exports.add_fund = (req, res) => {584 let now = moment();585 Case_deposit.create(586 {587 admin_id: req.userId,588 user_id: req.body.user_id,589 amount: req.body.amount,590 }591 )592 .then(res_data => {593 Case.count({where: {user_id: req.body.user_id}}).then(count => {594 if(count == 0 ) {595 Case.create({user_id: req.body.user_id, balance: req.body.amount}).then(create_case => {596 })597 }else if(count > 0) {598 Case.increment(599 {balance: req.body.amount},600 {where: {user_id: req.body.user_id}}601 )602 }603 })604 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });605 })606 .catch(err => {607 return res.status(500).send({ status:'fail', message: err.message });608 });609}610exports.setProfit = (req, res) => {611 User.update(612 {profit_percent: req.body.profit_percent},613 {where: {id: req.body.user_id}}614 )615 .then(user => {616 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });617 })618 .catch(err => {619 return res.status(500).send({ status:'fail', message: err.message });620 });621}622exports.getPlanSum = (req, res) => {623 let param = { where: { invest_type: req.body.invest_type, status: 'processando' } };624 if(req.body.invest_type == '' || req.body.invest_type == null) {625 param = {where: {status: 'processando'}};626 }627 Contract.sum('open_value', param).then(sum => {628 return res.status(200).send({ status:'success', sum: sum })629 }).catch(err => {630 return res.status(200).send({ status:'fail', message: err.message })631 })632}633exports.getPlanSumByUser = (req, res) => {634 let param = { where: { invest_type: req.body.invest_type, user_id: req.userId, status: 'processando' } };635 if(req.body.invest_type == '' || req.body.invest_type == null) {636 param = { where: { user_id: req.userId, status: 'processando' } };637 }638 Contract.sum('open_value', param).then(sum => {639 Contract.max('end_date', param).then(max => {640 return res.status(200).send({ status:'success', sum: sum, max: max })641 }).catch(err => {642 return res.status(200).send({ status:'fail', message: err.message })643 })644 }).catch(err => {645 return res.status(200).send({ status:'fail', message: err.message })646 })647}648exports.getPlanExpDateByUser = (req, res) => {649 let param = { where: { invest_type: req.body.invest_type, user_id: req.userId } };650 if(req.body.invest_type == '' || req.body.invest_type == null) {651 param = {};652 }653 Contract.max('end_date', param).then(max => {654 return res.status(200).send({ status:'success', max: max })655 }).catch(err => {656 return res.status(200).send({ status:'fail', message: err.message })657 })658}659exports.withdraw_sum_pending = (req, res) => {660 Withdraw.sum('value', {where: {status: 'pendente'}}).then(sum => {661 return res.status(200).send({ status:'success', sum: sum })662 }).catch(err => {663 return res.status(200).send({ status:'fail', message: err.message })664 })665}666exports.withdraw_sum_paid = (req, res) => {667 Withdraw.sum(668 'value',669 { where:670 {671 status: 'concluído',672 updatedAt: {673 [Op.gt]: moment(moment().format("YYYY-MM-DD")).subtract(1,'months').startOf('month').format('YYYY-MM-DD'),674 [Op.lte]: moment(moment().format("YYYY-MM-DD")).subtract(1,'months').endOf('month').format('YYYY-MM-DD')675 }676 }677 }678 )679 .then(sum => {680 return res.status(200).send({ status:'success', sum: sum })681 }).catch(err => {682 return res.status(200).send({ status:'fail', message: err.message })683 })684}685exports.active_users_count = (req, res) => {686 User.count({where: {active: 'YES', admin: '0'}}).then(count => {687 return res.status(200).send({ status:'success', sum: count })688 }).catch(err => {689 return res.status(200).send({ status:'fail', message: err.message })690 })691}692exports.getExpiredProfitSumByUser = (req, res) => {693 Contract.findAll(694 {695 where: { status: 'concluído', user_id: req.userId },696 raw: true697 }698 ).then((expired_datas) => {699 var total_sum = 0;700 var flexible_total_sum = 0;701 var item_total_sum = 0;702 if (expired_datas.length > 0) {703 expired_datas.forEach(function(item, index) {704 if(item.invest_type === 'CRESCIMENTO') {705 item_total_sum = Number(item.open_value)706 for(let i = 1; i <= 8; i++){707 item_total_sum = item_total_sum*item.percent/100 + item_total_sum708 }709 total_sum = total_sum + item_total_sum710 }else {711 item_total_sum = Number(item.open_value)712 item_total_sum = item_total_sum*item.percent/100 + item_total_sum713 flexible_total_sum = flexible_total_sum + item_total_sum714 }715 });716 return res.status(200).send({ status: 'success', sum: total_sum + flexible_total_sum });717 }else {718 return res.status(200).send({ status:'fail', sum: 0 })719 }720 }).catch(err => {721 return res.status(200).send({ status:'fail', message: err.message })722 });723}724exports.plan_numbers_this_month = (req, res) => {725 Contract.count(726 {727 where: {728 invest_type: 'CRESCIMENTO',729 status: 'processando',730 start_date: {731 [Op.gte]: moment(moment().format('YYYY-MM-DD')).subtract(0, 'months').startOf('month').format('YYYY-MM-DD'),732 [Op.lte]: moment(moment().format('YYYY-MM-DD')).subtract(0, 'months').endOf('month').format('YYYY-MM-DD')733 }734 }735 }736 ).then(count => {737 return res.status(200).send({ status: 'success', sum: count });738 }).catch(err => {739 return res.status(200).send({ status: 'fail', message: err.message });740 });741};742exports.cresc_plan_total = (req, res) => {743/* Contract.findAll({744 attributes: [745 [Sequelize.literal('SUM(open_value + 8 * open_value * percent / 100)'), 'totalsum']746 ],747 where: {748 invest_type: 'CRESCIMENTO',749 status: 'processando'750 }751 }).then(result => {752 return res.status(200).send({ status:'success', sum: result })753 }).catch(err => {754 return res.status(200).send({ status:'fail', message: err.message })755 })756 Contract.sum('open_value', { where: { invest_type: 'CRESCIMENTO' } }).then(sum => {757 return res.status(200).send({ status:'success', sum: sum })758 }).catch(err => {759 return res.status(200).send({ status:'fail', message: err.message })760 })*/761 Contract.findAll(762 {763 where: { status: 'processando', invest_type: 'CRESCIMENTO' },764 raw: true765 }766 ).then((expired_datas) => {767 var total_sum = 0;768 if (expired_datas.length > 0) {769 expired_datas.forEach(function(item, index) {770 var item_total_sum = Number(item.open_value)771 for(let i = 1; i <= 8; i++){772 item_total_sum = item_total_sum*item.percent/100 + item_total_sum773 }774 total_sum = total_sum + item_total_sum775 });776 return res.status(200).send({ status:'success', sum: total_sum})777 }else {778 return res.status(200).send({ status:'success', sum: 0 })779 }780 }).catch(err => {781 return res.status(200).send({ status:'fail', message: err.message })782 });783}784exports.admin_deposit_to_user = (req, res) => {785 let params = req.body;786 let now = moment();787 console.log(params.percent)788 Deposit.create(789 {790 admin_value: params.open_value,791 invest_type: params.invest_type,792 percent: params.percent,793 user_id: params.user_id,794 status: 'concluído',795 admin_id: req.userId,796 type: 1797 }798 );799 if(params.invest_type === 'FLEXIVEL') {800 Contract.findAll(801 {802 where: { invest_type: 'FLEXIVEL', user_id: params.user_id },803 raw: true804 }805 ).then((flexible_datas) => {806 if (flexible_datas.length == 0) {807 Contract.create(808 {809 user_id: params.user_id,810 open_value: params.open_value,811 invest_type: 'FLEXIVEL',812 // start_date: now.format("YYYY-MM-DD"),813 // end_date: moment(now.format("YYYY-MM-DD")).add(1, 'M'),814 end_date: moment(moment(params.start_date).format("YYYY-MM-DD")).add(1, 'M'),815 start_date: moment(params.start_date).format("YYYY-MM-DD"),816 status: 'processando',817 // percent: constant_config.FLEX_DEFAULT_PERCENT,818 percent: params.percent819 }820 ).then(res_data => {821 Contract_history.create(822 {823 user_id: res_data.user_id,824 value: res_data.open_value,825 contract_id: res_data.id,826 action_type: 0,827 invest_type: res_data.invest_type828 }829 )830 let contract_pdf_create = {831 user_id: params.user_id,832 invest_type: 'FLEXIVEL'833 }834 Contract_pdf.create(contract_pdf_create)835 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });836 })837 .catch(err => {838 return res.status(200).send({ status:'fail', message: err.message });839 });840 }else if (flexible_datas.length > 0) {841 Contract.findOne(842 {843 where: { invest_type: 'FLEXIVEL', user_id: params.user_id, status: 'processando' },844 raw: true845 }846 ).then((flex_pending_data) => {847 if(flex_pending_data) {848 Contract.update(849 { open_value: Number(flex_pending_data.open_value) + Number(params.open_value), percent: params.percent },850 { where: { id: flex_pending_data.id } }851 )852 .then(user => {853 return res.status(200).send({ status: 'success', message: 'Ação realizada com sucesso!' });854 })855 .catch(err => {856 return res.status(500).send({ status: 'fail', message: err.message });857 });858 }else {859 Contract.create(860 {861 user_id: params.user_id,862 open_value: params.open_value,863 invest_type: 'FLEXIVEL',864 // start_date: now.format("YYYY-MM-DD"),865 // end_date: moment(now.format("YYYY-MM-DD")).add(1, 'M'),866 end_date: moment(moment(params.start_date).format("YYYY-MM-DD")).add(1, 'M'),867 start_date: moment(params.start_date).format("YYYY-MM-DD"),868 status: 'processando',869 // percent: constant_config.FLEX_DEFAULT_PERCENT,870 percent: params.percent871 }872 ).then(res_data => {873 Contract_history.create(874 {875 user_id: res_data.user_id,876 value: res_data.open_value,877 contract_id: res_data.id,878 action_type: 0,879 invest_type: res_data.invest_type880 }881 )882 let contract_pdf_create = {883 user_id: params.user_id,884 invest_type: 'FLEXIVEL'885 }886 Contract_pdf.create(contract_pdf_create)887 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });888 })889 .catch(err => {890 return res.status(200).send({ status:'fail', message: err.message });891 });892 }893 })894 }895 })896 }else if(params.invest_type === 'CRESCIMENTO'){897 Contract.create(898 {899 user_id: params.user_id,900 open_value: params.open_value,901 invest_type: 'CRESCIMENTO',902 // start_date: now.format("YYYY-MM-DD"),903 // end_date: moment(now.format("YYYY-MM-DD")).add(8, 'M'),904 end_date: moment(moment(params.start_date).format("YYYY-MM-DD")).add(8, 'M'),905 start_date: moment(params.start_date).format("YYYY-MM-DD"),906 status: 'processando',907 // percent: constant_config.CRESC_DEFAULT_PERCENT,908 percent: params.percent909 }910 )911 .then(res_data => {912 Contract_history.create(913 {914 user_id: res_data.user_id,915 value: res_data.open_value,916 contract_id: res_data.id,917 action_type: 0,918 invest_type: res_data.invest_type919 }920 )921 Contract_percent.create({922 contract_id: res_data.id,923 // percent: constant_config.CRESC_DEFAULT_PERCENT924 percent: params.percent,925 })926 let contract_pdf_create = {927 user_id: params.user_id,928 invest_type: 'CRESCIMENTO',929 contract_id: res_data.id930 }931 Contract_pdf.create(contract_pdf_create)932 return res.status(200).send({ status:'success', message: "Ação realizada com sucesso!" });933 })934 .catch(err => {935 return res.status(200).send({ status:'fail', message: err.message });936 });937 }else {938 return res.status(200).send({ status: 'fail', message: 'fail' });939 }940};941exports.admin_create = (req, res) => {942 // Save User to Database943 let create_data = req.body;944 create_data.password = bcrypt.hashSync(req.body.password, 8);945 delete create_data.confirm;946 create_data.admin = '1';947 create_data.client_type = 'ADMIN';948 console.log(create_data);949 User.create(create_data)950 .then(user => {951 user.setRoles([2]).then(() => {952 res.send({ status: 'success', message: "Ação realizada com sucesso!" });953 });954 })955 .catch(err => {956 res.status(500).send({ stauts: 'fail', message: err.message });957 });...

Full Screen

Full Screen

testIncomplete.js

Source:testIncomplete.js Github

copy

Full Screen

1/*2 * Copyright 2012, Mozilla Foundation and contributors3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16'use strict';17var assert = require('../testharness/assert');18var helpers = require('./helpers');19exports.testBasic = function(options) {20 return helpers.audit(options, [21 {22 setup: 'tsu 2 extra',23 check: {24 args: {25 num: { value: 2, type: 'Argument' }26 }27 },28 post: function() {29 var requisition = options.requisition;30 assert.is(requisition._unassigned.length,31 1,32 'single unassigned: tsu 2 extra');33 assert.is(requisition._unassigned[0].param.type.isIncompleteName,34 false,35 'unassigned.isIncompleteName: tsu 2 extra');36 }37 },38 {39 setup: 'tsu',40 check: {41 args: {42 num: { value: undefined, type: 'BlankArgument' }43 }44 }45 },46 {47 setup: 'tsg',48 check: {49 args: {50 solo: { type: 'BlankArgument' },51 txt1: { type: 'BlankArgument' },52 bool: { type: 'BlankArgument' },53 txt2: { type: 'BlankArgument' },54 num: { type: 'BlankArgument' }55 }56 }57 }58 ]);59};60exports.testCompleted = function(options) {61 return helpers.audit(options, [62 {63 setup: 'tsela<TAB>',64 check: {65 args: {66 command: { name: 'tselarr', type: 'Argument' },67 num: { type: 'BlankArgument' },68 arr: { type: 'ArrayArgument' }69 }70 }71 },72 {73 setup: 'tsn dif ',74 check: {75 input: 'tsn dif ',76 hints: '<text>',77 markup: 'VVVVVVVV',78 cursor: 8,79 status: 'ERROR',80 args: {81 command: { name: 'tsn dif', type: 'MergedArgument' },82 text: { type: 'BlankArgument', status: 'INCOMPLETE' }83 }84 }85 },86 {87 setup: 'tsn di<TAB>',88 check: {89 input: 'tsn dif ',90 hints: '<text>',91 markup: 'VVVVVVVV',92 cursor: 8,93 status: 'ERROR',94 args: {95 command: { name: 'tsn dif', type: 'Argument' },96 text: { type: 'BlankArgument', status: 'INCOMPLETE' }97 }98 }99 },100 // The above 2 tests take different routes to 'tsn dif '.101 // The results should be similar. The difference is in args.command.type.102 {103 setup: 'tsg -',104 check: {105 input: 'tsg -',106 hints: '-txt1 <solo> [options]',107 markup: 'VVVVI',108 cursor: 5,109 status: 'ERROR',110 args: {111 solo: { value: undefined, status: 'INCOMPLETE' },112 txt1: { value: undefined, status: 'VALID' },113 bool: { value: false, status: 'VALID' },114 txt2: { value: undefined, status: 'VALID' },115 num: { value: undefined, status: 'VALID' }116 }117 }118 },119 {120 setup: 'tsg -<TAB>',121 check: {122 input: 'tsg --txt1 ',123 hints: '<string> <solo> [options]',124 markup: 'VVVVIIIIIIV',125 cursor: 11,126 status: 'ERROR',127 args: {128 solo: { value: undefined, status: 'INCOMPLETE' },129 txt1: { value: undefined, status: 'INCOMPLETE' },130 bool: { value: false, status: 'VALID' },131 txt2: { value: undefined, status: 'VALID' },132 num: { value: undefined, status: 'VALID' }133 }134 }135 },136 {137 setup: 'tsg --txt1 fred',138 check: {139 input: 'tsg --txt1 fred',140 hints: ' <solo> [options]',141 markup: 'VVVVVVVVVVVVVVV',142 status: 'ERROR',143 args: {144 solo: { value: undefined, status: 'INCOMPLETE' },145 txt1: { value: 'fred', status: 'VALID' },146 bool: { value: false, status: 'VALID' },147 txt2: { value: undefined, status: 'VALID' },148 num: { value: undefined, status: 'VALID' }149 }150 }151 },152 {153 setup: 'tscook key value --path path --',154 check: {155 input: 'tscook key value --path path --',156 hints: 'domain [options]',157 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVII',158 status: 'ERROR',159 args: {160 key: { value: 'key', status: 'VALID' },161 value: { value: 'value', status: 'VALID' },162 path: { value: 'path', status: 'VALID' },163 domain: { value: undefined, status: 'VALID' },164 secure: { value: false, status: 'VALID' }165 }166 }167 },168 {169 setup: 'tscook key value --path path --domain domain --',170 check: {171 input: 'tscook key value --path path --domain domain --',172 hints: 'secure [options]',173 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVII',174 status: 'ERROR',175 args: {176 key: { value: 'key', status: 'VALID' },177 value: { value: 'value', status: 'VALID' },178 path: { value: 'path', status: 'VALID' },179 domain: { value: 'domain', status: 'VALID' },180 secure: { value: false, status: 'VALID' }181 }182 }183 }184 ]);185};186exports.testCase = function(options) {187 return helpers.audit(options, [188 {189 setup: 'tsg AA',190 check: {191 input: 'tsg AA',192 hints: ' [options] -> aaa',193 markup: 'VVVVII',194 status: 'ERROR',195 args: {196 solo: { value: undefined, text: 'AA', status: 'INCOMPLETE' },197 txt1: { value: undefined, status: 'VALID' },198 bool: { value: false, status: 'VALID' },199 txt2: { value: undefined, status: 'VALID' },200 num: { value: undefined, status: 'VALID' }201 }202 }203 }204 ]);205};206exports.testIncomplete = function(options) {207 return helpers.audit(options, [208 {209 setup: 'tsm a a -',210 check: {211 args: {212 abc: { value: 'a', type: 'Argument' },213 txt: { value: 'a', type: 'Argument' },214 num: { value: undefined, arg: ' -', type: 'Argument', status: 'INCOMPLETE' }215 }216 }217 },218 {219 setup: 'tsg -',220 check: {221 args: {222 solo: { type: 'BlankArgument' },223 txt1: { type: 'BlankArgument' },224 bool: { type: 'BlankArgument' },225 txt2: { type: 'BlankArgument' },226 num: { type: 'BlankArgument' }227 }228 },229 post: function() {230 var requisition = options.requisition;231 assert.is(requisition._unassigned[0],232 requisition.getAssignmentAt(5),233 'unassigned -');234 assert.is(requisition._unassigned.length,235 1,236 'single unassigned - tsg -');237 assert.is(requisition._unassigned[0].param.type.isIncompleteName,238 true,239 'unassigned.isIncompleteName: tsg -');240 }241 }242 ]);243};244exports.testRepeated = function(options) {245 return helpers.audit(options, [246 {247 setup: 'tscook key value --path jjj --path kkk',248 check: {249 input: 'tscook key value --path jjj --path kkk',250 hints: ' [options]',251 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVEEEEEEVEEE',252 cursor: 38,253 current: '__unassigned',254 status: 'ERROR',255 options: [ ],256 message: '',257 predictions: [ ],258 unassigned: [ ' --path', ' kkk' ],259 args: {260 command: { name: 'tscook' },261 key: {262 value: 'key',263 arg: ' key',264 status: 'VALID',265 message: ''266 },267 value: {268 value: 'value',269 arg: ' value',270 status: 'VALID',271 message: ''272 },273 path: {274 value: 'jjj',275 arg: ' --path jjj',276 status: 'VALID',277 message: ''278 },279 domain: {280 value: undefined,281 arg: '',282 status: 'VALID',283 message: ''284 },285 secure: {286 value: false,287 arg: '',288 status: 'VALID',289 message: ''290 },291 }292 }293 }294 ]);295};296exports.testHidden = function(options) {297 return helpers.audit(options, [298 {299 setup: 'tshidde',300 check: {301 input: 'tshidde',302 hints: ' -> tse',303 status: 'ERROR'304 }305 },306 {307 setup: 'tshidden',308 check: {309 input: 'tshidden',310 hints: ' [options]',311 markup: 'VVVVVVVV',312 status: 'VALID',313 args: {314 visible: { value: undefined, status: 'VALID' },315 invisiblestring: { value: undefined, status: 'VALID' },316 invisibleboolean: { value: false, status: 'VALID' }317 }318 }319 },320 {321 setup: 'tshidden --vis',322 check: {323 input: 'tshidden --vis',324 hints: 'ible [options]',325 markup: 'VVVVVVVVVIIIII',326 status: 'ERROR',327 args: {328 visible: { value: undefined, status: 'VALID' },329 invisiblestring: { value: undefined, status: 'VALID' },330 invisibleboolean: { value: false, status: 'VALID' }331 }332 }333 },334 {335 setup: 'tshidden --invisiblestrin',336 check: {337 input: 'tshidden --invisiblestrin',338 hints: ' [options]',339 markup: 'VVVVVVVVVEEEEEEEEEEEEEEEE',340 status: 'ERROR',341 args: {342 visible: { value: undefined, status: 'VALID' },343 invisiblestring: { value: undefined, status: 'VALID' },344 invisibleboolean: { value: false, status: 'VALID' }345 }346 }347 },348 {349 setup: 'tshidden --invisiblestring',350 check: {351 input: 'tshidden --invisiblestring',352 hints: ' <string> [options]',353 markup: 'VVVVVVVVVIIIIIIIIIIIIIIIII',354 status: 'ERROR',355 args: {356 visible: { value: undefined, status: 'VALID' },357 invisiblestring: { value: undefined, status: 'INCOMPLETE' },358 invisibleboolean: { value: false, status: 'VALID' }359 }360 }361 },362 {363 setup: 'tshidden --invisiblestring x',364 check: {365 input: 'tshidden --invisiblestring x',366 hints: ' [options]',367 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV',368 status: 'VALID',369 args: {370 visible: { value: undefined, status: 'VALID' },371 invisiblestring: { value: 'x', status: 'VALID' },372 invisibleboolean: { value: false, status: 'VALID' }373 }374 }375 },376 {377 setup: 'tshidden --invisibleboolea',378 check: {379 input: 'tshidden --invisibleboolea',380 hints: ' [options]',381 markup: 'VVVVVVVVVEEEEEEEEEEEEEEEEE',382 status: 'ERROR',383 args: {384 visible: { value: undefined, status: 'VALID' },385 invisiblestring: { value: undefined, status: 'VALID' },386 invisibleboolean: { value: false, status: 'VALID' }387 }388 }389 },390 {391 setup: 'tshidden --invisibleboolean',392 check: {393 input: 'tshidden --invisibleboolean',394 hints: ' [options]',395 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVV',396 status: 'VALID',397 args: {398 visible: { value: undefined, status: 'VALID' },399 invisiblestring: { value: undefined, status: 'VALID' },400 invisibleboolean: { value: true, status: 'VALID' }401 }402 }403 },404 {405 setup: 'tshidden --visible xxx',406 check: {407 input: 'tshidden --visible xxx',408 markup: 'VVVVVVVVVVVVVVVVVVVVVV',409 status: 'VALID',410 hints: '',411 args: {412 visible: { value: 'xxx', status: 'VALID' },413 invisiblestring: { value: undefined, status: 'VALID' },414 invisibleboolean: { value: false, status: 'VALID' }415 }416 }417 }418 ]);...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful