How to use input2 method in ng-mocks

Best JavaScript code snippet using ng-mocks

pcre-test-4.js

Source:pcre-test-4.js Github

copy

Full Screen

1// Copyright 2013 the V8 project authors. All rights reserved.2// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.3//4// Redistribution and use in source and binary forms, with or without5// modification, are permitted provided that the following conditions6// are met:7// 1. Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// 2. Redistributions in binary form must reproduce the above copyright10// notice, this list of conditions and the following disclaimer in the11// documentation and/or other materials provided with the distribution.12//13// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED15// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE16// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY17// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES18// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;19// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON20// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT21// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS22// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.23description(24"A chunk of our port of PCRE's test suite, adapted to be more applicable to JavaScript."25);26var regex0 = /a.b/;27var input0 = "acb";28var results = ["acb"];29shouldBe('regex0.exec(input0);', 'results');30var input1 = "a\x7fb";31var results = ["a\u007fb"];32shouldBe('regex0.exec(input1);', 'results');33var input2 = "a\u0100b";34var results = ["a\u0100b"];35shouldBe('regex0.exec(input2);', 'results');36// Failers37var input3 = "a\nb";38var results = null;39shouldBe('regex0.exec(input3);', 'results');40var regex1 = /a(.{3})b/;41var input0 = "a\u4000xyb";42var results = ["a\u4000xyb", "\u4000xy"];43shouldBe('regex1.exec(input0);', 'results');44var input1 = "a\u4000\x7fyb";45var results = ["a\u4000\u007fyb", "\u4000\u007fy"];46shouldBe('regex1.exec(input1);', 'results');47var input2 = "a\u4000\u0100yb";48var results = ["a\u4000\u0100yb", "\u4000\u0100y"];49shouldBe('regex1.exec(input2);', 'results');50// Failers51var input3 = "a\u4000b";52var results = null;53shouldBe('regex1.exec(input3);', 'results');54var input4 = "ac\ncb";55var results = null;56shouldBe('regex1.exec(input4);', 'results');57var regex2 = /a(.*?)(.)/;58var input0 = "a\xc0\x88b";59var results = ["a\xc0", "", "\xc0"];60shouldBe('regex2.exec(input0);', 'results');61var regex3 = /a(.*?)(.)/;62var input0 = "a\u0100b";63var results = ["a\u0100", "", "\u0100"];64shouldBe('regex3.exec(input0);', 'results');65var regex4 = /a(.*)(.)/;66var input0 = "a\xc0\x88b";67var results = ["a\xc0\x88b", "\xc0\x88", "b"];68shouldBe('regex4.exec(input0);', 'results');69var regex5 = /a(.*)(.)/;70var input0 = "a\u0100b";71var results = ["a\u0100b", "\u0100", "b"];72shouldBe('regex5.exec(input0);', 'results');73var regex6 = /a(.)(.)/;74var input0 = "a\xc0\x92bcd";75var results = ["a\xc0\x92", "\xc0", "\x92"];76shouldBe('regex6.exec(input0);', 'results');77var regex7 = /a(.)(.)/;78var input0 = "a\u0240bcd";79var results = ["a\u0240b", "\u0240", "b"];80shouldBe('regex7.exec(input0);', 'results');81var regex8 = /a(.?)(.)/;82var input0 = "a\xc0\x92bcd";83var results = ["a\xc0\x92", "\xc0", "\x92"];84shouldBe('regex8.exec(input0);', 'results');85var regex9 = /a(.?)(.)/;86var input0 = "a\u0240bcd";87var results = ["a\u0240b", "\u0240", "b"];88shouldBe('regex9.exec(input0);', 'results');89var regex10 = /a(.??)(.)/;90var input0 = "a\xc0\x92bcd";91var results = ["a\xc0", "", "\xc0"];92shouldBe('regex10.exec(input0);', 'results');93var regex11 = /a(.??)(.)/;94var input0 = "a\u0240bcd";95var results = ["a\u0240", "", "\u0240"];96shouldBe('regex11.exec(input0);', 'results');97var regex12 = /a(.{3})b/;98var input0 = "a\u1234xyb";99var results = ["a\u1234xyb", "\u1234xy"];100shouldBe('regex12.exec(input0);', 'results');101var input1 = "a\u1234\u4321yb";102var results = ["a\u1234\u4321yb", "\u1234\u4321y"];103shouldBe('regex12.exec(input1);', 'results');104var input2 = "a\u1234\u4321\u3412b";105var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"];106shouldBe('regex12.exec(input2);', 'results');107// Failers108var input3 = "a\u1234b";109var results = null;110shouldBe('regex12.exec(input3);', 'results');111var input4 = "ac\ncb";112var results = null;113shouldBe('regex12.exec(input4);', 'results');114var regex13 = /a(.{3,})b/;115var input0 = "a\u1234xyb";116var results = ["a\u1234xyb", "\u1234xy"];117shouldBe('regex13.exec(input0);', 'results');118var input1 = "a\u1234\u4321yb";119var results = ["a\u1234\u4321yb", "\u1234\u4321y"];120shouldBe('regex13.exec(input1);', 'results');121var input2 = "a\u1234\u4321\u3412b";122var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"];123shouldBe('regex13.exec(input2);', 'results');124var input3 = "axxxxbcdefghijb";125var results = ["axxxxbcdefghijb", "xxxxbcdefghij"];126shouldBe('regex13.exec(input3);', 'results');127var input4 = "a\u1234\u4321\u3412\u3421b";128var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"];129shouldBe('regex13.exec(input4);', 'results');130// Failers131var input5 = "a\u1234b";132var results = null;133shouldBe('regex13.exec(input5);', 'results');134var regex14 = /a(.{3,}?)b/;135var input0 = "a\u1234xyb";136var results = ["a\u1234xyb", "\u1234xy"];137shouldBe('regex14.exec(input0);', 'results');138var input1 = "a\u1234\u4321yb";139var results = ["a\u1234\u4321yb", "\u1234\u4321y"];140shouldBe('regex14.exec(input1);', 'results');141var input2 = "a\u1234\u4321\u3412b";142var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"];143shouldBe('regex14.exec(input2);', 'results');144var input3 = "axxxxbcdefghijb";145var results = ["axxxxb", "xxxx"];146shouldBe('regex14.exec(input3);', 'results');147var input4 = "a\u1234\u4321\u3412\u3421b";148var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"];149shouldBe('regex14.exec(input4);', 'results');150// Failers151var input5 = "a\u1234b";152var results = null;153shouldBe('regex14.exec(input5);', 'results');154var regex15 = /a(.{3,5})b/;155var input0 = "a\u1234xyb";156var results = ["a\u1234xyb", "\u1234xy"];157shouldBe('regex15.exec(input0);', 'results');158var input1 = "a\u1234\u4321yb";159var results = ["a\u1234\u4321yb", "\u1234\u4321y"];160shouldBe('regex15.exec(input1);', 'results');161var input2 = "a\u1234\u4321\u3412b";162var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"];163shouldBe('regex15.exec(input2);', 'results');164var input3 = "axxxxbcdefghijb";165var results = ["axxxxb", "xxxx"];166shouldBe('regex15.exec(input3);', 'results');167var input4 = "a\u1234\u4321\u3412\u3421b";168var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"];169shouldBe('regex15.exec(input4);', 'results');170var input5 = "axbxxbcdefghijb";171var results = ["axbxxb", "xbxx"];172shouldBe('regex15.exec(input5);', 'results');173var input6 = "axxxxxbcdefghijb";174var results = ["axxxxxb", "xxxxx"];175shouldBe('regex15.exec(input6);', 'results');176// Failers177var input7 = "a\u1234b";178var results = null;179shouldBe('regex15.exec(input7);', 'results');180var input8 = "axxxxxxbcdefghijb";181var results = null;182shouldBe('regex15.exec(input8);', 'results');183var regex16 = /a(.{3,5}?)b/;184var input0 = "a\u1234xyb";185var results = ["a\u1234xyb", "\u1234xy"];186shouldBe('regex16.exec(input0);', 'results');187var input1 = "a\u1234\u4321yb";188var results = ["a\u1234\u4321yb", "\u1234\u4321y"];189shouldBe('regex16.exec(input1);', 'results');190var input2 = "a\u1234\u4321\u3412b";191var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"];192shouldBe('regex16.exec(input2);', 'results');193var input3 = "axxxxbcdefghijb";194var results = ["axxxxb", "xxxx"];195shouldBe('regex16.exec(input3);', 'results');196var input4 = "a\u1234\u4321\u3412\u3421b";197var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"];198shouldBe('regex16.exec(input4);', 'results');199var input5 = "axbxxbcdefghijb";200var results = ["axbxxb", "xbxx"];201shouldBe('regex16.exec(input5);', 'results');202var input6 = "axxxxxbcdefghijb";203var results = ["axxxxxb", "xxxxx"];204shouldBe('regex16.exec(input6);', 'results');205// Failers206var input7 = "a\u1234b";207var results = null;208shouldBe('regex16.exec(input7);', 'results');209var input8 = "axxxxxxbcdefghijb";210var results = null;211shouldBe('regex16.exec(input8);', 'results');212var regex17 = /^[a\u00c0]/;213// Failers214var input0 = "\u0100";215var results = null;216shouldBe('regex17.exec(input0);', 'results');217var regex21 = /(?:\u0100){3}b/;218var input0 = "\u0100\u0100\u0100b";219var results = ["\u0100\u0100\u0100b"];220shouldBe('regex21.exec(input0);', 'results');221// Failers222var input1 = "\u0100\u0100b";223var results = null;224shouldBe('regex21.exec(input1);', 'results');225var regex22 = /\u00ab/;226var input0 = "\u00ab";227var results = ["\u00ab"];228shouldBe('regex22.exec(input0);', 'results');229var input1 = "\xc2\xab";230var results = ["\u00ab"];231shouldBe('regex22.exec(input1);', 'results');232// Failers233var input2 = "\x00{ab}";234var results = null;235shouldBe('regex22.exec(input2);', 'results');236var regex30 = /^[^a]{2}/;237var input0 = "\u0100bc";238var results = ["\u0100b"];239shouldBe('regex30.exec(input0);', 'results');240var regex31 = /^[^a]{2,}/;241var input0 = "\u0100bcAa";242var results = ["\u0100bcA"];243shouldBe('regex31.exec(input0);', 'results');244var regex32 = /^[^a]{2,}?/;245var input0 = "\u0100bca";246var results = ["\u0100b"];247shouldBe('regex32.exec(input0);', 'results');248var regex33 = /^[^a]{2}/i;249var input0 = "\u0100bc";250var results = ["\u0100b"];251shouldBe('regex33.exec(input0);', 'results');252var regex34 = /^[^a]{2,}/i;253var input0 = "\u0100bcAa";254var results = ["\u0100bc"];255shouldBe('regex34.exec(input0);', 'results');256var regex35 = /^[^a]{2,}?/i;257var input0 = "\u0100bca";258var results = ["\u0100b"];259shouldBe('regex35.exec(input0);', 'results');260var regex36 = /\u0100{0,0}/;261var input0 = "abcd";262var results = [""];263shouldBe('regex36.exec(input0);', 'results');264var regex37 = /\u0100?/;265var input0 = "abcd";266var results = [""];267shouldBe('regex37.exec(input0);', 'results');268var input1 = "\u0100\u0100";269var results = ["\u0100"];270shouldBe('regex37.exec(input1);', 'results');271var regex38 = /\u0100{0,3}/;272var input0 = "\u0100\u0100";273var results = ["\u0100\u0100"];274shouldBe('regex38.exec(input0);', 'results');275var input1 = "\u0100\u0100\u0100\u0100";276var results = ["\u0100\u0100\u0100"];277shouldBe('regex38.exec(input1);', 'results');278var regex39 = /\u0100*/;279var input0 = "abce";280var results = [""];281shouldBe('regex39.exec(input0);', 'results');282var input1 = "\u0100\u0100\u0100\u0100";283var results = ["\u0100\u0100\u0100\u0100"];284shouldBe('regex39.exec(input1);', 'results');285var regex40 = /\u0100{1,1}/;286var input0 = "abcd\u0100\u0100\u0100\u0100";287var results = ["\u0100"];288shouldBe('regex40.exec(input0);', 'results');289var regex41 = /\u0100{1,3}/;290var input0 = "abcd\u0100\u0100\u0100\u0100";291var results = ["\u0100\u0100\u0100"];292shouldBe('regex41.exec(input0);', 'results');293var regex42 = /\u0100+/;294var input0 = "abcd\u0100\u0100\u0100\u0100";295var results = ["\u0100\u0100\u0100\u0100"];296shouldBe('regex42.exec(input0);', 'results');297var regex43 = /\u0100{3}/;298var input0 = "abcd\u0100\u0100\u0100XX";299var results = ["\u0100\u0100\u0100"];300shouldBe('regex43.exec(input0);', 'results');301var regex44 = /\u0100{3,5}/;302var input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX";303var results = ["\u0100\u0100\u0100\u0100\u0100"];304shouldBe('regex44.exec(input0);', 'results');305var regex45 = /\u0100{3,}/;306var input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX";307var results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100"];308shouldBe('regex45.exec(input0);', 'results');309var regex47 = /\D*/;310var input0 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";311var results = ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"];312shouldBe('regex47.exec(input0);', 'results');313var regex48 = /\D*/;314var input0 = "\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100";315var results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100"];316shouldBe('regex48.exec(input0);', 'results');317var regex49 = /\D/;318var input0 = "1X2";319var results = ["X"];320shouldBe('regex49.exec(input0);', 'results');321var input1 = "1\u01002";322var results = ["\u0100"];323shouldBe('regex49.exec(input1);', 'results');324var regex50 = />\S/;325var input0 = "> >X Y";326var results = [">X"];327shouldBe('regex50.exec(input0);', 'results');328var input1 = "> >\u0100 Y";329var results = [">\u0100"];330shouldBe('regex50.exec(input1);', 'results');331var regex51 = /\d/;332var input0 = "\u01003";333var results = ["3"];334shouldBe('regex51.exec(input0);', 'results');335var regex52 = /\s/;336var input0 = "\u0100 X";337var results = [" "];338shouldBe('regex52.exec(input0);', 'results');339var regex53 = /\D+/;340var input0 = "12abcd34";341var results = ["abcd"];342shouldBe('regex53.exec(input0);', 'results');343// Failers344var input1 = "1234";345var results = null;346shouldBe('regex53.exec(input1);', 'results');347var regex54 = /\D{2,3}/;348var input0 = "12abcd34";349var results = ["abc"];350shouldBe('regex54.exec(input0);', 'results');351var input1 = "12ab34";352var results = ["ab"];353shouldBe('regex54.exec(input1);', 'results');354// Failers355var input2 = "1234";356var results = null;357shouldBe('regex54.exec(input2);', 'results');358var input3 = "12a34";359var results = null;360shouldBe('regex54.exec(input3);', 'results');361var regex55 = /\D{2,3}?/;362var input0 = "12abcd34";363var results = ["ab"];364shouldBe('regex55.exec(input0);', 'results');365var input1 = "12ab34";366var results = ["ab"];367shouldBe('regex55.exec(input1);', 'results');368// Failers369var input2 = "1234";370var results = null;371shouldBe('regex55.exec(input2);', 'results');372var input3 = "12a34";373var results = null;374shouldBe('regex55.exec(input3);', 'results');375var regex56 = /\d+/;376var input0 = "12abcd34";377var results = ["12"];378shouldBe('regex56.exec(input0);', 'results');379var regex57 = /\d{2,3}/;380var input0 = "12abcd34";381var results = ["12"];382shouldBe('regex57.exec(input0);', 'results');383var input1 = "1234abcd";384var results = ["123"];385shouldBe('regex57.exec(input1);', 'results');386// Failers387var input2 = "1.4";388var results = null;389shouldBe('regex57.exec(input2);', 'results');390var regex58 = /\d{2,3}?/;391var input0 = "12abcd34";392var results = ["12"];393shouldBe('regex58.exec(input0);', 'results');394var input1 = "1234abcd";395var results = ["12"];396shouldBe('regex58.exec(input1);', 'results');397// Failers398var input2 = "1.4";399var results = null;400shouldBe('regex58.exec(input2);', 'results');401var regex59 = /\S+/;402var input0 = "12abcd34";403var results = ["12abcd34"];404shouldBe('regex59.exec(input0);', 'results');405// Failers406var input1 = " ";407var results = null;408shouldBe('regex59.exec(input1);', 'results');409var regex60 = /\S{2,3}/;410var input0 = "12abcd34";411var results = ["12a"];412shouldBe('regex60.exec(input0);', 'results');413var input1 = "1234abcd";414var results = ["123"];415shouldBe('regex60.exec(input1);', 'results');416// Failers417var input2 = " ";418var results = null;419shouldBe('regex60.exec(input2);', 'results');420var regex61 = /\S{2,3}?/;421var input0 = "12abcd34";422var results = ["12"];423shouldBe('regex61.exec(input0);', 'results');424var input1 = "1234abcd";425var results = ["12"];426shouldBe('regex61.exec(input1);', 'results');427// Failers428var input2 = " ";429var results = null;430shouldBe('regex61.exec(input2);', 'results');431var regex62 = />\s+</;432var input0 = "12> <34";433var results = ["> <"];434shouldBe('regex62.exec(input0);', 'results');435var regex63 = />\s{2,3}</;436var input0 = "ab> <cd";437var results = ["> <"];438shouldBe('regex63.exec(input0);', 'results');439var input1 = "ab> <ce";440var results = ["> <"];441shouldBe('regex63.exec(input1);', 'results');442// Failers443var input2 = "ab> <cd";444var results = null;445shouldBe('regex63.exec(input2);', 'results');446var regex64 = />\s{2,3}?</;447var input0 = "ab> <cd";448var results = ["> <"];449shouldBe('regex64.exec(input0);', 'results');450var input1 = "ab> <ce";451var results = ["> <"];452shouldBe('regex64.exec(input1);', 'results');453// Failers454var input2 = "ab> <cd";455var results = null;456shouldBe('regex64.exec(input2);', 'results');457var regex65 = /\w+/;458var input0 = "12 34";459var results = ["12"];460shouldBe('regex65.exec(input0);', 'results');461// Failers462var input1 = "+++=*!";463var results = null;464shouldBe('regex65.exec(input1);', 'results');465var regex66 = /\w{2,3}/;466var input0 = "ab cd";467var results = ["ab"];468shouldBe('regex66.exec(input0);', 'results');469var input1 = "abcd ce";470var results = ["abc"];471shouldBe('regex66.exec(input1);', 'results');472// Failers473var input2 = "a.b.c";474var results = null;475shouldBe('regex66.exec(input2);', 'results');476var regex67 = /\w{2,3}?/;477var input0 = "ab cd";478var results = ["ab"];479shouldBe('regex67.exec(input0);', 'results');480var input1 = "abcd ce";481var results = ["ab"];482shouldBe('regex67.exec(input1);', 'results');483// Failers484var input2 = "a.b.c";485var results = null;486shouldBe('regex67.exec(input2);', 'results');487var regex68 = /\W+/;488var input0 = "12====34";489var results = ["===="];490shouldBe('regex68.exec(input0);', 'results');491// Failers492var input1 = "abcd";493var results = null;494shouldBe('regex68.exec(input1);', 'results');495var regex69 = /\W{2,3}/;496var input0 = "ab====cd";497var results = ["==="];498shouldBe('regex69.exec(input0);', 'results');499var input1 = "ab==cd";500var results = ["=="];501shouldBe('regex69.exec(input1);', 'results');502// Failers503var input2 = "a.b.c";504var results = null;505shouldBe('regex69.exec(input2);', 'results');506var regex70 = /\W{2,3}?/;507var input0 = "ab====cd";508var results = ["=="];509shouldBe('regex70.exec(input0);', 'results');510var input1 = "ab==cd";511var results = ["=="];512shouldBe('regex70.exec(input1);', 'results');513// Failers514var input2 = "a.b.c";515var results = null;516shouldBe('regex70.exec(input2);', 'results');517var regex71 = /[\u0100]/;518var input0 = "\u0100";519var results = ["\u0100"];520shouldBe('regex71.exec(input0);', 'results');521var input1 = "Z\u0100";522var results = ["\u0100"];523shouldBe('regex71.exec(input1);', 'results');524var input2 = "\u0100Z";525var results = ["\u0100"];526shouldBe('regex71.exec(input2);', 'results');527var regex72 = /[Z\u0100]/;528var input0 = "Z\u0100";529var results = ["Z"];530shouldBe('regex72.exec(input0);', 'results');531var input1 = "\u0100";532var results = ["\u0100"];533shouldBe('regex72.exec(input1);', 'results');534var input2 = "\u0100Z";535var results = ["\u0100"];536shouldBe('regex72.exec(input2);', 'results');537var regex73 = /[\u0100\u0200]/;538var input0 = "ab\u0100cd";539var results = ["\u0100"];540shouldBe('regex73.exec(input0);', 'results');541var input1 = "ab\u0200cd";542var results = ["\u0200"];543shouldBe('regex73.exec(input1);', 'results');544var regex74 = /[\u0100-\u0200]/;545var input0 = "ab\u0100cd";546var results = ["\u0100"];547shouldBe('regex74.exec(input0);', 'results');548var input1 = "ab\u0200cd";549var results = ["\u0200"];550shouldBe('regex74.exec(input1);', 'results');551var input2 = "ab\u0111cd";552var results = ["\u0111"];553shouldBe('regex74.exec(input2);', 'results');554var regex75 = /[z-\u0200]/;555var input0 = "ab\u0100cd";556var results = ["\u0100"];557shouldBe('regex75.exec(input0);', 'results');558var input1 = "ab\u0200cd";559var results = ["\u0200"];560shouldBe('regex75.exec(input1);', 'results');561var input2 = "ab\u0111cd";562var results = ["\u0111"];563shouldBe('regex75.exec(input2);', 'results');564var input3 = "abzcd";565var results = ["z"];566shouldBe('regex75.exec(input3);', 'results');567var input4 = "ab|cd";568var results = ["|"];569shouldBe('regex75.exec(input4);', 'results');570var regex76 = /[Q\u0100\u0200]/;571var input0 = "ab\u0100cd";572var results = ["\u0100"];573shouldBe('regex76.exec(input0);', 'results');574var input1 = "ab\u0200cd";575var results = ["\u0200"];576shouldBe('regex76.exec(input1);', 'results');577var input2 = "Q?";578var results = ["Q"];579shouldBe('regex76.exec(input2);', 'results');580var regex77 = /[Q\u0100-\u0200]/;581var input0 = "ab\u0100cd";582var results = ["\u0100"];583shouldBe('regex77.exec(input0);', 'results');584var input1 = "ab\u0200cd";585var results = ["\u0200"];586shouldBe('regex77.exec(input1);', 'results');587var input2 = "ab\u0111cd";588var results = ["\u0111"];589shouldBe('regex77.exec(input2);', 'results');590var input3 = "Q?";591var results = ["Q"];592shouldBe('regex77.exec(input3);', 'results');593var regex78 = /[Qz-\u0200]/;594var input0 = "ab\u0100cd";595var results = ["\u0100"];596shouldBe('regex78.exec(input0);', 'results');597var input1 = "ab\u0200cd";598var results = ["\u0200"];599shouldBe('regex78.exec(input1);', 'results');600var input2 = "ab\u0111cd";601var results = ["\u0111"];602shouldBe('regex78.exec(input2);', 'results');603var input3 = "abzcd";604var results = ["z"];605shouldBe('regex78.exec(input3);', 'results');606var input4 = "ab|cd";607var results = ["|"];608shouldBe('regex78.exec(input4);', 'results');609var input5 = "Q?";610var results = ["Q"];611shouldBe('regex78.exec(input5);', 'results');612var regex79 = /[\u0100\u0200]{1,3}/;613var input0 = "ab\u0100cd";614var results = ["\u0100"];615shouldBe('regex79.exec(input0);', 'results');616var input1 = "ab\u0200cd";617var results = ["\u0200"];618shouldBe('regex79.exec(input1);', 'results');619var input2 = "ab\u0200\u0100\u0200\u0100cd";620var results = ["\u0200\u0100\u0200"];621shouldBe('regex79.exec(input2);', 'results');622var regex80 = /[\u0100\u0200]{1,3}?/;623var input0 = "ab\u0100cd";624var results = ["\u0100"];625shouldBe('regex80.exec(input0);', 'results');626var input1 = "ab\u0200cd";627var results = ["\u0200"];628shouldBe('regex80.exec(input1);', 'results');629var input2 = "ab\u0200\u0100\u0200\u0100cd";630var results = ["\u0200"];631shouldBe('regex80.exec(input2);', 'results');632var regex81 = /[Q\u0100\u0200]{1,3}/;633var input0 = "ab\u0100cd";634var results = ["\u0100"];635shouldBe('regex81.exec(input0);', 'results');636var input1 = "ab\u0200cd";637var results = ["\u0200"];638shouldBe('regex81.exec(input1);', 'results');639var input2 = "ab\u0200\u0100\u0200\u0100cd";640var results = ["\u0200\u0100\u0200"];641shouldBe('regex81.exec(input2);', 'results');642var regex82 = /[Q\u0100\u0200]{1,3}?/;643var input0 = "ab\u0100cd";644var results = ["\u0100"];645shouldBe('regex82.exec(input0);', 'results');646var input1 = "ab\u0200cd";647var results = ["\u0200"];648shouldBe('regex82.exec(input1);', 'results');649var input2 = "ab\u0200\u0100\u0200\u0100cd";650var results = ["\u0200"];651shouldBe('regex82.exec(input2);', 'results');652var regex86 = /[^\u0100\u0200]X/;653var input0 = "AX";654var results = ["AX"];655shouldBe('regex86.exec(input0);', 'results');656var input1 = "\u0150X";657var results = ["\u0150X"];658shouldBe('regex86.exec(input1);', 'results');659var input2 = "\u0500X";660var results = ["\u0500X"];661shouldBe('regex86.exec(input2);', 'results');662// Failers663var input3 = "\u0100X";664var results = null;665shouldBe('regex86.exec(input3);', 'results');666var input4 = "\u0200X";667var results = null;668shouldBe('regex86.exec(input4);', 'results');669var regex87 = /[^Q\u0100\u0200]X/;670var input0 = "AX";671var results = ["AX"];672shouldBe('regex87.exec(input0);', 'results');673var input1 = "\u0150X";674var results = ["\u0150X"];675shouldBe('regex87.exec(input1);', 'results');676var input2 = "\u0500X";677var results = ["\u0500X"];678shouldBe('regex87.exec(input2);', 'results');679// Failers680var input3 = "\u0100X";681var results = null;682shouldBe('regex87.exec(input3);', 'results');683var input4 = "\u0200X";684var results = null;685shouldBe('regex87.exec(input4);', 'results');686var input5 = "QX";687var results = null;688shouldBe('regex87.exec(input5);', 'results');689var regex88 = /[^\u0100-\u0200]X/;690var input0 = "AX";691var results = ["AX"];692shouldBe('regex88.exec(input0);', 'results');693var input1 = "\u0500X";694var results = ["\u0500X"];695shouldBe('regex88.exec(input1);', 'results');696// Failers697var input2 = "\u0100X";698var results = null;699shouldBe('regex88.exec(input2);', 'results');700var input3 = "\u0150X";701var results = null;702shouldBe('regex88.exec(input3);', 'results');703var input4 = "\u0200X";704var results = null;705shouldBe('regex88.exec(input4);', 'results');706var regex91 = /[z-\u0100]/i;707var input0 = "z";708var results = ["z"];709shouldBe('regex91.exec(input0);', 'results');710var input1 = "Z";711var results = ["Z"];712shouldBe('regex91.exec(input1);', 'results');713var input2 = "\u0100";714var results = ["\u0100"];715shouldBe('regex91.exec(input2);', 'results');716// Failers717var input3 = "\u0102";718var results = null;719shouldBe('regex91.exec(input3);', 'results');720var input4 = "y";721var results = null;722shouldBe('regex91.exec(input4);', 'results');723var regex92 = /[\xFF]/;724var input0 = ">\xff<";725var results = ["\xff"];726shouldBe('regex92.exec(input0);', 'results');727var regex93 = /[\xff]/;728var input0 = ">\u00ff<";729var results = ["\u00ff"];730shouldBe('regex93.exec(input0);', 'results');731var regex94 = /[^\xFF]/;732var input0 = "XYZ";733var results = ["X"];734shouldBe('regex94.exec(input0);', 'results');735var regex95 = /[^\xff]/;736var input0 = "XYZ";737var results = ["X"];738shouldBe('regex95.exec(input0);', 'results');739var input1 = "\u0123";740var results = ["\u0123"];741shouldBe('regex95.exec(input1);', 'results');742var regex96 = /^[ac]*b/;743var input0 = "xb";744var results = null;745shouldBe('regex96.exec(input0);', 'results');746var regex97 = /^[ac\u0100]*b/;747var input0 = "xb";748var results = null;749shouldBe('regex97.exec(input0);', 'results');750var regex98 = /^[^x]*b/i;751var input0 = "xb";752var results = null;753shouldBe('regex98.exec(input0);', 'results');754var regex99 = /^[^x]*b/;755var input0 = "xb";756var results = null;757shouldBe('regex99.exec(input0);', 'results');758var regex100 = /^\d*b/;759var input0 = "xb";760var results = null;761shouldBe('regex100.exec(input0);', 'results');762var regex102 = /^\u0085$/i;763var input0 = "\u0085";764var results = ["\u0085"];765shouldBe('regex102.exec(input0);', 'results');766var regex103 = /^\xe1\x88\xb4/;767var input0 = "\xe1\x88\xb4";768var results = ["\xe1\x88\xb4"];769shouldBe('regex103.exec(input0);', 'results');770var regex104 = /^\xe1\x88\xb4/;771var input0 = "\xe1\x88\xb4";772var results = ["\xe1\x88\xb4"];773shouldBe('regex104.exec(input0);', 'results');774var regex105 = /(.{1,5})/;775var input0 = "abcdefg";776var results = ["abcde", "abcde"];777shouldBe('regex105.exec(input0);', 'results');778var input1 = "ab";779var results = ["ab", "ab"];780shouldBe('regex105.exec(input1);', 'results');781var regex106 = /a*\u0100*\w/;782var input0 = "a";783var results = ["a"];784shouldBe('regex106.exec(input0);', 'results');785var regex107 = /[\S\s]*/;786var input0 = "abc\n\r\u0442\u0435\u0441\u0442xyz";787var results = ["abc\u000a\u000d\u0442\u0435\u0441\u0442xyz"];788shouldBe('regex107.exec(input0);', 'results');789var regexGlobal0 = /[^a]+/g;790var input0 = "bcd";791var results = ["bcd"];792shouldBe('input0.match(regexGlobal0);', 'results');793var input1 = "\u0100aY\u0256Z";794var results = ["\u0100", "Y\u0256Z"];795shouldBe('input1.match(regexGlobal0);', 'results');796var regexGlobal1 = /\S\S/g;797var input0 = "A\u00a3BC";798var results = ["A\u00a3", "BC"];799shouldBe('input0.match(regexGlobal1);', 'results');800var regexGlobal2 = /\S{2}/g;801var input0 = "A\u00a3BC";802var results = ["A\u00a3", "BC"];803shouldBe('input0.match(regexGlobal2);', 'results');804var regexGlobal3 = /\W\W/g;805var input0 = "+\u00a3==";806var results = ["+\u00a3", "=="];807shouldBe('input0.match(regexGlobal3);', 'results');808var regexGlobal4 = /\W{2}/g;809var input0 = "+\u00a3==";810var results = ["+\u00a3", "=="];811shouldBe('input0.match(regexGlobal4);', 'results');812var regexGlobal5 = /\S/g;813var input0 = "\u0442\u0435\u0441\u0442";814var results = ["\u0442", "\u0435", "\u0441", "\u0442"];815shouldBe('input0.match(regexGlobal5);', 'results');816var regexGlobal6 = /[\S]/g;817var input0 = "\u0442\u0435\u0441\u0442";818var results = ["\u0442", "\u0435", "\u0441", "\u0442"];819shouldBe('input0.match(regexGlobal6);', 'results');820var regexGlobal7 = /\D/g;821var input0 = "\u0442\u0435\u0441\u0442";822var results = ["\u0442", "\u0435", "\u0441", "\u0442"];823shouldBe('input0.match(regexGlobal7);', 'results');824var regexGlobal8 = /[\D]/g;825var input0 = "\u0442\u0435\u0441\u0442";826var results = ["\u0442", "\u0435", "\u0441", "\u0442"];827shouldBe('input0.match(regexGlobal8);', 'results');828var regexGlobal9 = /\W/g;829var input0 = "\u2442\u2435\u2441\u2442";830var results = ["\u2442", "\u2435", "\u2441", "\u2442"];831shouldBe('input0.match(regexGlobal9);', 'results');832var regexGlobal10 = /[\W]/g;833var input0 = "\u2442\u2435\u2441\u2442";834var results = ["\u2442", "\u2435", "\u2441", "\u2442"];835shouldBe('input0.match(regexGlobal10);', 'results');836var regexGlobal11 = /[\u041f\S]/g;837var input0 = "\u0442\u0435\u0441\u0442";838var results = ["\u0442", "\u0435", "\u0441", "\u0442"];839shouldBe('input0.match(regexGlobal11);', 'results');840var regexGlobal12 = /.[^\S]./g;841var input0 = "abc def\u0442\u0443xyz\npqr";842var results = ["c d", "z\u000ap"];843shouldBe('input0.match(regexGlobal12);', 'results');844var regexGlobal13 = /.[^\S\n]./g;845var input0 = "abc def\u0442\u0443xyz\npqr";846var results = ["c d"];847shouldBe('input0.match(regexGlobal13);', 'results');848var regexGlobal14 = /[\W]/g;849var input0 = "+\u2442";850var results = ["+", "\u2442"];851shouldBe('input0.match(regexGlobal14);', 'results');852var regexGlobal15 = /[^a-zA-Z]/g;853var input0 = "+\u2442";854var results = ["+", "\u2442"];855shouldBe('input0.match(regexGlobal15);', 'results');856var regexGlobal16 = /[^a-zA-Z]/g;857var input0 = "A\u0442";858var results = ["\u0442"];859shouldBe('input0.match(regexGlobal16);', 'results');860var regexGlobal17 = /[\S]/g;861var input0 = "A\u0442";862var results = ["A", "\u0442"];863shouldBe('input0.match(regexGlobal17);', 'results');864var regexGlobal19 = /[\D]/g;865var input0 = "A\u0442";866var results = ["A", "\u0442"];867shouldBe('input0.match(regexGlobal19);', 'results');868var regexGlobal21 = /[^a-z]/g;869var input0 = "A\u0422";870var results = ["A", "\u0422"];871shouldBe('input0.match(regexGlobal21);', 'results');872var regexGlobal24 = /[\S]/g;873var input0 = "A\u0442";874var results = ["A", "\u0442"];875shouldBe('input0.match(regexGlobal24);', 'results');876var regexGlobal25 = /[^A-Z]/g;877var input0 = "a\u0442";878var results = ["a", "\u0442"];879shouldBe('input0.match(regexGlobal25);', 'results');880var regexGlobal26 = /[\W]/g;881var input0 = "+\u2442";882var results = ["+", "\u2442"];883shouldBe('input0.match(regexGlobal26);', 'results');884var regexGlobal27 = /[\D]/g;885var input0 = "M\u0442";886var results = ["M", "\u0442"];887shouldBe('input0.match(regexGlobal27);', 'results');888var regexGlobal28 = /[^a]+/ig;889var input0 = "bcd";890var results = ["bcd"];891shouldBe('input0.match(regexGlobal28);', 'results');892var input1 = "\u0100aY\u0256Z";893var results = ["\u0100", "Y\u0256Z"];894shouldBe('input1.match(regexGlobal28);', 'results');895var regexGlobal29 = /(a|)/g;896var input0 = "catac";897var results = ["", "a", "", "a", "", ""];898shouldBe('input0.match(regexGlobal29);', 'results');899var input1 = "a\u0256a";900var results = ["a", "", "a", ""];901shouldBe('input1.match(regexGlobal29);', 'results');902// DISABLED:903// These tests use (?<) or (?>) constructs. These are not currently valid in ECMAScript,904// but these tests may be useful if similar constructs are introduced in the future.905//var regex18 = /(?<=aXb)cd/;906//var input0 = "aXbcd";907//var results = ["cd"];908//shouldBe('regex18.exec(input0);', 'results');909//910//var regex19 = /(?<=a\u0100b)cd/;911//var input0 = "a\u0100bcd";912//var results = ["cd"];913//shouldBe('regex19.exec(input0);', 'results');914//915//var regex20 = /(?<=a\u100000b)cd/;916//var input0 = "a\u100000bcd";917//var results = ["cd"];918//shouldBe('regex20.exec(input0);', 'results');919//920//var regex23 = /(?<=(.))X/;921//var input0 = "WXYZ";922//var results = ["X", "W"];923//shouldBe('regex23.exec(input0);', 'results');924//var input1 = "\u0256XYZ";925//var results = ["X", "\u0256"];926//shouldBe('regex23.exec(input1);', 'results');927//// Failers928//var input2 = "XYZ";929//var results = null;930//shouldBe('regex23.exec(input2);', 'results');931//932//var regex46 = /(?<=a\u0100{2}b)X/;933//var input0 = "Xyyya\u0100\u0100bXzzz";934//var results = ["X"];935//shouldBe('regex46.exec(input0);', 'results');936//937//var regex83 = /(?<=[\u0100\u0200])X/;938//var input0 = "abc\u0200X";939//var results = ["X"];940//shouldBe('regex83.exec(input0);', 'results');941//var input1 = "abc\u0100X";942//var results = ["X"];943//shouldBe('regex83.exec(input1);', 'results');944//// Failers945//var input2 = "X";946//var results = null;947//shouldBe('regex83.exec(input2);', 'results');948//949//var regex84 = /(?<=[Q\u0100\u0200])X/;950//var input0 = "abc\u0200X";951//var results = ["X"];952//shouldBe('regex84.exec(input0);', 'results');953//var input1 = "abc\u0100X";954//var results = ["X"];955//shouldBe('regex84.exec(input1);', 'results');956//var input2 = "abQX";957//var results = ["X"];958//shouldBe('regex84.exec(input2);', 'results');959//// Failers960//var input3 = "X";961//var results = null;962//shouldBe('regex84.exec(input3);', 'results');963//964//var regex85 = /(?<=[\u0100\u0200]{3})X/;965//var input0 = "abc\u0100\u0200\u0100X";966//var results = ["X"];967//shouldBe('regex85.exec(input0);', 'results');968//// Failers969//var input1 = "abc\u0200X";970//var results = null;971//shouldBe('regex85.exec(input1);', 'results');972//var input2 = "X";973//var results = null;974//shouldBe('regex85.exec(input2);', 'results');975// DISABLED:976// These tests use PCRE's \C token. This is not currently valid in ECMAScript,977// but these tests may be useful if similar constructs are introduced in the future.978//var regex24 = /X(\C{3})/;979//var input0 = "X\u1234";980//var results = ["X\u1234", "\u1234"];981//shouldBe('regex24.exec(input0);', 'results');982//983//var regex25 = /X(\C{4})/;984//var input0 = "X\u1234YZ";985//var results = ["X\u1234Y", "\u1234Y"];986//shouldBe('regex25.exec(input0);', 'results');987//988//var regex26 = /X\C*/;989//var input0 = "XYZabcdce";990//var results = ["XYZabcdce"];991//shouldBe('regex26.exec(input0);', 'results');992//993//var regex27 = /X\C*?/;994//var input0 = "XYZabcde";995//var results = ["X"];996//shouldBe('regex27.exec(input0);', 'results');997//998//var regex28 = /X\C{3,5}/;999//var input0 = "Xabcdefg";1000//var results = ["Xabcde"];1001//shouldBe('regex28.exec(input0);', 'results');1002//var input1 = "X\u1234";1003//var results = ["X\u1234"];1004//shouldBe('regex28.exec(input1);', 'results');1005//var input2 = "X\u1234YZ";1006//var results = ["X\u1234YZ"];1007//shouldBe('regex28.exec(input2);', 'results');1008//var input3 = "X\u1234\u0512";1009//var results = ["X\u1234\u0512"];1010//shouldBe('regex28.exec(input3);', 'results');1011//var input4 = "X\u1234\u0512YZ";1012//var results = ["X\u1234\u0512"];1013//shouldBe('regex28.exec(input4);', 'results');1014//1015//var regex29 = /X\C{3,5}?/;1016//var input0 = "Xabcdefg";1017//var results = ["Xabc"];1018//shouldBe('regex29.exec(input0);', 'results');1019//var input1 = "X\u1234";1020//var results = ["X\u1234"];1021//shouldBe('regex29.exec(input1);', 'results');1022//var input2 = "X\u1234YZ";1023//var results = ["X\u1234"];1024//shouldBe('regex29.exec(input2);', 'results');1025//var input3 = "X\u1234\u0512";1026//var results = ["X\u1234"];1027//shouldBe('regex29.exec(input3);', 'results');1028//1029//var regex89 = /a\Cb/;1030//var input0 = "aXb";1031//var results = ["aXb"];1032//shouldBe('regex89.exec(input0);', 'results');1033//var input1 = "a\nb";1034//var results = ["a\x0ab"];1035//shouldBe('regex89.exec(input1);', 'results');1036//1037//var regex90 = /a\Cb/;1038//var input0 = "aXb";1039//var results = ["aXb"];1040//shouldBe('regex90.exec(input0);', 'results');1041//var input1 = "a\nb";1042//var results = ["a\u000ab"];1043//shouldBe('regex90.exec(input1);', 'results');1044//// Failers1045//var input2 = "a\u0100b";1046//var results = null;...

Full Screen

Full Screen

width_units.test.js

Source:width_units.test.js Github

copy

Full Screen

1/* eslint-env jest */2import { processWidthInput, prettifyWidth } from '../width_units'3import { SETTINGS_UNITS_IMPERIAL, SETTINGS_UNITS_METRIC } from '../../users/constants'4// Use this when it doesn't matter what the unit is.5// TODO: Switch default units to metric6const DEFAULT_UNITS = SETTINGS_UNITS_IMPERIAL7describe('processWidthInput()', () => {8 it('trims leading and trailing whitespace', () => {9 const input = processWidthInput(' 3.75 ', DEFAULT_UNITS)10 expect(input).toEqual(3.75)11 })12 it('parses a value (3)', () => {13 const value = '3'14 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)15 expect(input1).toEqual(10)16 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)17 expect(input2).toEqual(3)18 })19 it('parses a value with trailing period (3.)', () => {20 const value = '3.'21 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)22 expect(input1).toEqual(10)23 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)24 expect(input2).toEqual(3)25 })26 it('parses a value with a prime symbol (3\')', () => {27 const value = '3\''28 // Even in metric mode, the prime symbol should cause the value to be interpreted as imperial units29 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)30 expect(input1).toEqual(3)31 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)32 expect(input2).toEqual(3)33 })34 it('parses a value with a double-prime symbol (3")', () => {35 const value = '3"'36 // Even in metric mode, the double-prime symbol should cause the value to be interpreted as imperial units37 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)38 expect(input1).toEqual(0.25)39 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)40 expect(input2).toEqual(0.25)41 })42 it('parses a decimal with trailing zeroes (3.00)', () => {43 const value = '3.00'44 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)45 expect(input1).toEqual(10)46 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)47 expect(input2).toEqual(3)48 })49 it('parses a decimal without units (3.75)', () => {50 const value = '3.75'51 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)52 expect(input1).toEqual(12.5)53 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)54 expect(input2).toEqual(3.75)55 })56 it('parses a decimal with prime symbol (3.75\')', () => {57 const value = '3.75\''58 // Even in metric mode, the prime symbol should cause the value to be59 // interpreted as imperial units60 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)61 expect(input1).toEqual(3.75)62 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)63 expect(input2).toEqual(3.75)64 })65 it('parses a decimal with `ft` unit (3.75 ft)', () => {66 const value = '3.75 ft'67 // Even in metric mode, the `ft` should cause the value to be interpreted68 // as imperial units69 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)70 expect(input1).toEqual(3.75)71 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)72 expect(input2).toEqual(3.75)73 })74 it('parses a decimal with `ft.` unit (3.75 ft.)', () => {75 const value = '3.75 ft.'76 // Even in metric mode, the `ft` should cause the value to be interpreted77 // as imperial units78 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)79 expect(input1).toEqual(3.75)80 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)81 expect(input2).toEqual(3.75)82 })83 it('parses a decimal with `ft` unit and no space (3.75ft)', () => {84 const value = '3.75ft'85 // Even in metric mode, the `ft` should cause the value to be interpreted86 // as imperial units87 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)88 expect(input1).toEqual(3.75)89 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)90 expect(input2).toEqual(3.75)91 })92 it('parses `feet` unit (3 feet)', () => {93 const value = '3 feet'94 // Even in metric mode, the `feet` should cause the value to be interpreted95 // as imperial units96 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)97 expect(input1).toEqual(3)98 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)99 expect(input2).toEqual(3)100 })101 it('parses `in` unit', () => {102 const value = '12 in'103 // Even in metric mode, the `in` should cause the value to be interpreted104 // as imperial units105 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)106 expect(input1).toEqual(1)107 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)108 expect(input2).toEqual(1)109 })110 it('parses `in.` unit', () => {111 const value = '24 in.'112 // Even in metric mode, the `in.` should cause the value to be interpreted113 // as imperial units114 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)115 expect(input1).toEqual(2)116 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)117 expect(input2).toEqual(2)118 })119 it('parses `inch` unit', () => {120 const value = '36 inches'121 // Even in metric mode, the `inch` should cause the value to be interpreted122 // as imperial units123 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)124 expect(input1).toEqual(3)125 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)126 expect(input2).toEqual(3)127 })128 it('parses `inches` unit', () => {129 const value = '6 inches'130 // Even in metric mode, the `inches` should cause the value to be131 // interpreted as imperial units132 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)133 expect(input1).toEqual(0.5)134 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)135 expect(input2).toEqual(0.5)136 })137 it('parses feet and inches with prime and double-prime symbols (3\'9")', () => {138 const value = "3'9\""139 // Even in metric mode, the `ft` should cause the value to be interpreted140 // as imperial units141 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)142 expect(input1).toEqual(3.75)143 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)144 expect(input2).toEqual(3.75)145 })146 it('parses feet and inches with prime symbol, lacking a final double-prime symbol (3\'9)', () => {147 const value = "3'9"148 // Even in metric mode, the `ft` should cause the value to be interpreted149 // as imperial units150 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)151 expect(input1).toEqual(3.75)152 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)153 expect(input2).toEqual(3.75)154 })155 it('parses feet and inches with prime and double-prime symbols and hyphen separator (3\'-9")', () => {156 const value = "3'-9\""157 // Even in metric mode, the `ft` should cause the value to be interpreted158 // as imperial units159 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)160 expect(input1).toEqual(3.75)161 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)162 expect(input2).toEqual(3.75)163 })164 it('parses feet and inches with prime and hyphen separator, lacking a final double-prime symbol (3\'-9)', () => {165 const value = "3'-9"166 // Even in metric mode, the `ft` should cause the value to be interpreted167 // as imperial units168 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)169 expect(input1).toEqual(3.75)170 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)171 expect(input2).toEqual(3.75)172 })173 it('parses feet and inches with prime and double-prime symbols and space separator (3\' 9")', () => {174 const value = "3' 9\""175 // Even in metric mode, the `ft` should cause the value to be interpreted176 // as imperial units177 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)178 expect(input1).toEqual(3.75)179 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)180 expect(input2).toEqual(3.75)181 })182 it('parses feet and inches with prime and space separator, lacking a final double-prime symbol (3\' 9)', () => {183 const value = "3' 9"184 // Even in metric mode, the `ft` should cause the value to be interpreted185 // as imperial units186 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)187 expect(input1).toEqual(3.75)188 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)189 expect(input2).toEqual(3.75)190 })191 it('parses feet and inches with support for leading zero (0\'6")', () => {192 const value = "0'6"193 // Even in metric mode, the `ft` should cause the value to be interpreted194 // as imperial units195 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)196 expect(input1).toEqual(0.5)197 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)198 expect(input2).toEqual(0.5)199 })200 it('parses feet and inches with support for leading zero (0\'-3")', () => {201 const value = "0'-3"202 // Even in metric mode, the `ft` should cause the value to be interpreted203 // as imperial units204 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)205 expect(input1).toEqual(0.25)206 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)207 expect(input2).toEqual(0.25)208 })209 it('parses a value with meters unit (3m)', () => {210 const value = '3m'211 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)212 expect(input1).toEqual(10)213 // Even in imperial mode, the `m` should cause the value to be interpreted214 // as metric units215 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)216 expect(input2).toEqual(10)217 })218 it('parses a value with a space between it and the meters unit (3 m)', () => {219 const value = '3 m'220 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)221 expect(input1).toEqual(10)222 // Even in imperial mode, the `m` should cause the value to be interpreted223 // as metric units224 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)225 expect(input2).toEqual(10)226 })227 it('parses a decimal value with meters unit (3.0m)', () => {228 const value = '3.0m'229 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)230 expect(input1).toEqual(10)231 // Even in imperial mode, the `m` should cause the value to be interpreted232 // as metric units233 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)234 expect(input2).toEqual(10)235 })236 it('parses a decimal value with a space between it and the meters unit (3.0 m)', () => {237 const value = '3.0 m'238 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)239 expect(input1).toEqual(10)240 // Even in imperial mode, the `m` should cause the value to be interpreted241 // as metric units242 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)243 expect(input2).toEqual(10)244 })245 it('parses a value with centimeters unit (150cm)', () => {246 const value = '150cm'247 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)248 expect(input1).toEqual(5) // 150cm => 1.5m => 5ft249 // Even in imperial mode, the `cm` should cause the value to be interpreted250 // as metric units251 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)252 expect(input2).toEqual(5)253 })254 it('parses a value with the Cyrillic meters unit (3 м)', () => {255 const value = '3 м'256 const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)257 expect(input1).toEqual(10)258 // Even in imperial mode, the `м` should cause the value to be interpreted259 // as metric units260 const input2 = processWidthInput(value, SETTINGS_UNITS_IMPERIAL)261 expect(input2).toEqual(10)262 })263})264describe('prettifyWidth()', () => {265 it('formats a metric width in English', () => {266 const width = prettifyWidth(10, SETTINGS_UNITS_METRIC, 'en')267 expect(width).toBe('3 m')268 })269 // Test passes if output uses Western Arabic numerals270 // If it outputs Eastern Arabic numerals, it fails271 it('formats a metric width in Arabic', () => {272 const width = prettifyWidth(10, SETTINGS_UNITS_METRIC, 'ar')273 expect(width).toBe('3 m')274 })275 // Test passes if output uses the Cyrillic character for meter276 it('formats a metric width in Russian', () => {277 const width = prettifyWidth(10, SETTINGS_UNITS_METRIC, 'ru')278 expect(width).toBe('3 м')279 })280 it('formats a decimal metric width', () => {281 const width = prettifyWidth(9, SETTINGS_UNITS_METRIC, 'en')282 expect(width).toBe('2.7 m')283 })284 it('formats an imperial unit width', () => {285 const width = prettifyWidth(3, SETTINGS_UNITS_IMPERIAL, 'en')286 expect(width).toBe('3\'')287 })288 describe('imperial units with vulgar fractions', () => {289 it('formats .125 as ⅛', () => {290 const width = prettifyWidth(3.125, SETTINGS_UNITS_IMPERIAL, 'en')291 expect(width).toBe('3⅛\'')292 })293 it('formats .25 as ¼', () => {294 const width = prettifyWidth(3.25, SETTINGS_UNITS_IMPERIAL, 'en')295 expect(width).toBe('3¼\'')296 })297 it('formats .375 as ⅜', () => {298 const width = prettifyWidth(3.375, SETTINGS_UNITS_IMPERIAL, 'en')299 expect(width).toBe('3⅜\'')300 })301 it('formats .5 as ½', () => {302 const width = prettifyWidth(3.5, SETTINGS_UNITS_IMPERIAL, 'en')303 expect(width).toBe('3½\'')304 })305 it('formats .625 as ⅝', () => {306 const width = prettifyWidth(3.625, SETTINGS_UNITS_IMPERIAL, 'en')307 expect(width).toBe('3⅝\'')308 })309 it('formats .75 as ¾', () => {310 const width = prettifyWidth(3.75, SETTINGS_UNITS_IMPERIAL, 'en')311 expect(width).toBe('3¾\'')312 })313 it('formats .875 as ⅞', () => {314 const width = prettifyWidth(3.875, SETTINGS_UNITS_IMPERIAL, 'en')315 expect(width).toBe('3⅞\'')316 })317 })318 it('formats an imperial unit with decimals', () => {319 const width = prettifyWidth(3.65, SETTINGS_UNITS_IMPERIAL, 'en')320 expect(width).toBe('3.65\'')321 })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { input2 } from 'ng-mocks';2describe('TestComponent', () => {3 let component: TestComponent;4 let fixture: ComponentFixture<TestComponent>;5 beforeEach(async(() => {6 TestBed.configureTestingModule({7 })8 .compileComponents();9 }));10 beforeEach(() => {11 fixture = TestBed.createComponent(TestComponent);12 component = fixture.componentInstance;13 fixture.detectChanges();14 });15 it('should create', () => {16 expect(component).toBeTruthy();17 });18 it('should set input', () => {19 input2(fixture, 'testInput', 'test');20 expect(component.testInput).toBe('test');21 });22});23import { Component, Input } from '@angular/core';24@Component({25})26export class TestComponent {27 @Input() testInput: string;28}29import { ComponentFixture, TestBed, async } from '@angular/core/testing';30import { TestComponent } from './test.component';31describe('TestComponent', () => {32 let component: TestComponent;33 let fixture: ComponentFixture<TestComponent>;34 beforeEach(async(() => {35 TestBed.configureTestingModule({36 })37 .compileComponents();38 }));39 beforeEach(() => {40 fixture = TestBed.createComponent(TestComponent);41 component = fixture.componentInstance;42 fixture.detectChanges();43 });44 it('should create', () => {45 expect(component).toBeTruthy();46 });47 it('should set input', () => {48 component.testInput = 'test';49 fixture.detectChanges();50 expect(fixture.nativeElement.textContent).toBe('Test');51 });52});53import { ComponentFixture, TestBed, async } from '@angular/core/testing';54import { TestComponent } from './test.component';55import { ComponentFixture, TestBed, async } from '@angular/core/testing';56import { TestComponent } from './test.component';57import { ComponentFixture, TestBed, async } from '@angular/core/testing';58import { TestComponent } from './test.component';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { input2 } from 'ng-mocks';2describe('MyComponent', () => {3 let component: MyComponent;4 beforeEach(() => {5 TestBed.configureTestingModule({6 }).compileComponents();7 component = new MyComponent();8 });9 it('should do something', () => {10 const mockEvent = {11 target: {12 },13 };14 input2(component, 'myInput', mockEvent);15 expect(component.myInput).toBe('test');16 });17});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Input2 } from 'ng-mocks';2import { Component } from '@angular/core';3import { ComponentFixture, TestBed } from '@angular/core/testing';4@Component({5 <span>{{ value }}</span>6 <span>{{ value }}</span>7})8class TestComponent {9 @Input2() value: string;10 @Input2() isTrue: boolean;11}12describe('TestComponent', () => {13 let component: TestComponent;14 let fixture: ComponentFixture<TestComponent>;15 beforeEach(async () => {16 await TestBed.configureTestingModule({17 }).compileComponents();18 });19 beforeEach(() => {20 fixture = TestBed.createComponent(TestComponent);21 component = fixture.componentInstance;22 fixture.detectChanges();23 });24 it('should create', () => {25 expect(component).toBeTruthy();26 });27 it('should render value in a span tag', () => {28 Input2(component, 'value', 'Test Value');29 fixture.detectChanges();30 const compiled = fixture.nativeElement;31 expect(compiled.querySelector('span').textContent).toContain('Test Value');32 });33 it('should render value in a span tag', () => {34 Input2(component, 'isTrue', true);35 fixture.detectChanges();36 const compiled = fixture.nativeElement;37 expect(compiled.querySelector('span').textContent).toContain('Test Value');38 });39});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { input2 } from 'ng-mocks';2import { createComponent } from 'ng-mocks';3import { ComponentFixture, TestBed } from '@angular/core/testing';4import { AppComponent } from './app.component';5import { By } from '@angular/platform-browser';6import { DebugElement } from '@angular/core';7describe('AppComponent', () => {8 let component: AppComponent;9 let fixture: ComponentFixture<AppComponent>;10 let debugElement: DebugElement;11 let htmlElement: HTMLElement;12 beforeEach(async () => {13 await TestBed.configureTestingModule({14 })15 .compileComponents();16 });17 beforeEach(() => {18 fixture = TestBed.createComponent(AppComponent);19 component = fixture.componentInstance;20 debugElement = fixture.debugElement.query(By.css('h1'));21 htmlElement = debugElement.nativeElement;22 });23 it('should render title', () => {24 expect(htmlElement.textContent).toContain('Welcome to app!');25 });26 it('should set name property', () => {27 expect(component.name).toEqual('Angular');28 });29 it('should set name property using input2 method', () => {30 input2(fixture, AppComponent, { name: 'Angular' });31 expect(component.name).toEqual('Angular');32 });33 it('should set name property using createComponent method', () => {34 const component = createComponent(AppComponent, { name: 'Angular' });35 expect(component.name).toEqual('Angular');36 });37});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { input2 } from 'ng-mocks';2import { ngMocks } from 'ng-mocks';3const component = ngMocks.findInstance(MyComponent);4const component = input2(MyComponent);5const component = ngMocks.findInstance(MyComponent);6const component = input2(MyComponent);7const component = ngMocks.findInstance(MyComponent);8const component = input2(MyComponent);9const component = ngMocks.findInstance(MyComponent);10const component = input2(MyComponent);11const component = ngMocks.findInstance(MyComponent);12const component = input2(MyComponent);13const component = ngMocks.findInstance(MyComponent);14const component = input2(MyComponent);15const component = ngMocks.findInstance(MyComponent);16const component = input2(MyComponent);17const component = ngMocks.findInstance(MyComponent);18const component = input2(MyComponent);19const component = ngMocks.findInstance(MyComponent);20const component = input2(MyComponent);21const component = ngMocks.findInstance(MyComponent);22const component = input2(MyComponent);23const component = ngMocks.findInstance(MyComponent);24const component = input2(MyComponent);25const component = ngMocks.findInstance(MyComponent);26const component = input2(MyComponent);27const component = ngMocks.findInstance(MyComponent);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { input2 } from 'ng-mocks/dist/lib/common/mock';2export class TestComponent {3 public input2Method() {4 input2(this, 'input2', 'new value');5 }6}7import { TestBed } from '@angular/core/testing';8import { TestComponent } from './test.component';9describe('TestComponent', () => {10 beforeEach(async () => {11 await TestBed.configureTestingModule({12 }).compileComponents();13 });14 it('should be able to test input2 method', () => {15 const fixture = TestBed.createComponent(TestComponent);16 const component = fixture.componentInstance;17 component.input2Method();18 expect(component.input2).toBe('new value');19 });20});21import { TestBed } from '@angular/core/testing';22import { TestComponent } from './test.component';23describe('TestComponent', () => {24 beforeEach(async () => {25 await TestBed.configureTestingModule({26 }).compileComponents();27 });28 it('should be able to test input2 method', () => {29 const fixture = TestBed.createComponent(TestComponent);30 const component = fixture.componentInstance;31 input2(component, 'input', 'new value');32 expect(component.input).toBe('new value');33 });34});

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 ng-mocks 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