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 without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1.  Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9# 2.  Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#
13# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24KDE JS Test
25
26On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
27
28
29PASS (new RegExp()).source is '(?:)'
30PASS Boolean(new RegExp()) is true
31PASS isNaN(Number(new RegExp())) is true
32PASS RegExp(/x/).source is 'x'
33PASS RegExp('x', 'g').global is true
34PASS RegExp('x').source is 'x'
35PASS new RegExp('x').source is 'x'
36PASS (/a/).global is false
37PASS typeof (/a/).global is 'boolean'
38PASS rg.global is true
39PASS (/a/).ignoreCase is false
40PASS ri.ignoreCase is true
41PASS (/a/).multiline is false
42PASS rm.multiline is true
43PASS rg.toString() is '/a/g'
44PASS ri.toString() is '/a/i'
45PASS rm.toString() is '/a/m'
46PASS rg.global is true
47PASS ri.ignoreCase is true
48PASS rm.multiline is true
49PASS Boolean(/a/.test) is true
50PASS /(b)c/.exec('abcd').toString() is "bc,b"
51PASS /(b)c/.exec('abcd').length is 2
52PASS /(b)c/.exec('abcd').index is 1
53PASS /(b)c/.exec('abcd').input is 'abcd'
54PASS rs.source is 'foo'
55PASS var r = new RegExp(/x/); r.global=true; r.lastIndex = -1; typeof r.test('a') is 'boolean'
56PASS 'abcdefghi'.match(/(abc)def(ghi)/).toString() is 'abcdefghi,abc,ghi'
57PASS /(abc)def(ghi)/.exec('abcdefghi').toString() is 'abcdefghi,abc,ghi'
58PASS RegExp.$1 is 'abc'
59PASS RegExp.$2 is 'ghi'
60PASS RegExp.$3 is ''
61PASS 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/).toString() is 'abcdefghi,abcdefghi,bcdefgh,cdefg,def,e'
62PASS RegExp.$1 is 'abcdefghi'
63PASS RegExp.$2 is 'bcdefgh'
64PASS RegExp.$3 is 'cdefg'
65PASS RegExp.$4 is 'def'
66PASS RegExp.$5 is 'e'
67PASS RegExp.$6 is ''
68PASS '(100px 200px 150px 15px)'.match(/\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)/).toString() is '(100px 200px 150px 15px),100,px,200,px,150,px,15,px'
69PASS RegExp.$1 is '100'
70PASS RegExp.$3 is '200'
71PASS RegExp.$5 is '150'
72PASS RegExp.$7 is '15'
73PASS ''.match(/((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*)/) is null
74PASS RegExp.$1 is '100'
75PASS RegExp.$3 is '200'
76PASS RegExp.$5 is '150'
77PASS RegExp.$7 is '15'
78PASS 'faure@kde.org'.match(invalidChars) == null is true
79PASS 'faure-kde@kde.org'.match(invalidChars) == null is false
80PASS 'test1test2'.replace('test','X') is 'X1test2'
81PASS 'test1test2'.replace(/\d/,'X') is 'testXtest2'
82PASS '1test2test3'.replace(/\d/,'') is 'test2test3'
83PASS 'test1test2'.replace(/test/g,'X') is 'X1X2'
84PASS '1test2test3'.replace(/\d/g,'') is 'testtest'
85PASS '1test2test3'.replace(/x/g,'') is '1test2test3'
86PASS 'test1test2'.replace(/(te)(st)/g,'$2$1') is 'stte1stte2'
87PASS 'foo+bar'.replace(/\+/g,'%2B') is 'foo%2Bbar'
88PASS caught is true
89PASS 'foo'.replace(/z?/g,'x') is 'xfxoxox'
90PASS 'test test'.replace(/\s*/g,'') is 'testtest'
91PASS 'abc$%@'.replace(/[^0-9a-z]*/gi,'') is 'abc'
92PASS 'ab'.replace(/[^\d\.]*/gi,'') is ''
93PASS '1ab'.replace(/[^\d\.]*/gi,'') is '1'
94PASS '1test2test3blah'.split(/test/).toString() is '1,2,3blah'
95PASS reg.exec(str).toString() is '98 ,98 '
96PASS reg.lastIndex is 3
97PASS RegExp.$1 is '98 '
98PASS RegExp.$2 is ''
99PASS reg.exec(str).toString() is '76 ,76 '
100PASS reg.lastIndex is 6
101PASS RegExp.$1 is '76 '
102PASS RegExp.$2 is ''
103PASS reg.exec(str) is null
104PASS reg.lastIndex is 0
105PASS myRe=/d(b+)d/g; myArray = myRe.exec('cdbbdbsbz'); myRe.lastIndex is 5
106PASS reg.ignoreCase == true is true
107PASS reg.global === false is true
108PASS reg.multiline === false is true
109PASS reg.test('UGO') is true
110PASS reg.x = 1; reg.x is 1
111PASS var r2 = reg; r2.x = 2; reg.x is 2
112PASS str.match(re).toString() is 'Chapter 3.4.5.1,Chapter 3.4.5.1,.1'
113PASS str.match(/d/gi).toString() is 'D,d'
114PASS /\u0061/.source is '\\u0061'
115PASS 'abc'.match(/\u0062/).toString() is 'b'
116PASS Object.prototype.toString.apply(RegExp.prototype) is '[object RegExp]'
117PASS typeof RegExp.prototype.toString() is 'string'
118PASS new RegExp().toString() is '/(?:)/'
119PASS (new RegExp('(?:)')).source is '(?:)'
120PASS /(?:)/.toString() is '/(?:)/'
121PASS /(?:)/.source is '(?:)'
122Done.
123PASS successfullyParsed is true
124
125TEST COMPLETE
126
127