1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_5/RegExp/regress-429241.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,200 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +var gTestfile = 'regress-429241.js'; 1.9 +var BUGNUMBER = 429241; 1.10 +var summary = '\\x or \\u followed by too few hex digits'; 1.11 +var r; 1.12 + 1.13 +reportCompare( 1.14 + "x", 1.15 + (r = /[\x]+/.exec("\\x\0")) && r[0], 1.16 + "Section 1" 1.17 +); 1.18 + 1.19 +reportCompare( 1.20 + "xy", 1.21 + (r = /[\xy]+/.exec("\\xy\0")) && r[0], 1.22 + "Section 2" 1.23 +); 1.24 + 1.25 +reportCompare( 1.26 + "x0", 1.27 + (r = /[\x0]+/.exec("\\x0\0")) && r[0], 1.28 + "Section 3" 1.29 +); 1.30 + 1.31 +reportCompare( 1.32 + "x0y", 1.33 + (r = /[\x0y]+/.exec("\\x0y\0")) && r[0], 1.34 + "Section 4" 1.35 +); 1.36 + 1.37 +reportCompare( 1.38 + "\0", 1.39 + (r = /[\x00]+/.exec("\\x\0")) && r[0], 1.40 + "Section 5" 1.41 +); 1.42 + 1.43 +reportCompare( 1.44 + "0\0", 1.45 + (r = /[\x000]+/.exec("0\0")) && r[0], 1.46 + "Section 6" 1.47 +); 1.48 + 1.49 +reportCompare( 1.50 + "x", 1.51 + (r = /^\x$/.exec("x")) && r[0], 1.52 + "Section 7" 1.53 +); 1.54 + 1.55 +reportCompare( 1.56 + "xy", 1.57 + (r = /^\xy$/.exec("xy")) && r[0], 1.58 + "Section 8" 1.59 +); 1.60 + 1.61 +reportCompare( 1.62 + "x0", 1.63 + (r = /^\x0$/.exec("x0")) && r[0], 1.64 + "Section 9" 1.65 +); 1.66 + 1.67 +reportCompare( 1.68 + "x0y", 1.69 + (r = /^\x0y$/.exec("x0y")) && r[0], 1.70 + "Section 10" 1.71 +); 1.72 + 1.73 +reportCompare( 1.74 + null, 1.75 + /^\x00$/.exec("\0" + "0"), 1.76 + "Section 11" 1.77 +); 1.78 + 1.79 +reportCompare( 1.80 + "\0" + "0", 1.81 + (r = /^\x000$/.exec("\0" + "0")) && r[0], 1.82 + "Section 12" 1.83 +); 1.84 + 1.85 +reportCompare( 1.86 + "u", 1.87 + (r = /[\u]+/.exec("\\u\0")) && r[0], 1.88 + "Section 13" 1.89 +); 1.90 + 1.91 +reportCompare( 1.92 + "uy", 1.93 + (r = /[\uy]+/.exec("\\uy\0")) && r[0], 1.94 + "Section 14" 1.95 +); 1.96 + 1.97 +reportCompare( 1.98 + "u0", 1.99 + (r = /[\u0]+/.exec("\\u0\0")) && r[0], 1.100 + "Section 15" 1.101 +); 1.102 + 1.103 +reportCompare( 1.104 + "u0", 1.105 + (r = /[\u00]+/.exec("\\u0\0")) && r[0], 1.106 + "Section 16" 1.107 +); 1.108 + 1.109 +reportCompare( 1.110 + "u0", 1.111 + (r = /[\u000]+/.exec("\\u0\0")) && r[0], 1.112 + "Section 17" 1.113 +); 1.114 + 1.115 +reportCompare( 1.116 + "u0y", 1.117 + (r = /[\u0y]+/.exec("\\u0y\0")) && r[0], 1.118 + "Section 18" 1.119 +); 1.120 + 1.121 +reportCompare( 1.122 + "u0y", 1.123 + (r = /[\u00y]+/.exec("\\u0y\0")) && r[0], 1.124 + "Section 19" 1.125 +); 1.126 + 1.127 +reportCompare( 1.128 + "u0y", 1.129 + (r = /[\u000y]+/.exec("\\u0y\0")) && r[0], 1.130 + "Section 20" 1.131 +); 1.132 + 1.133 +reportCompare( 1.134 + "\0", 1.135 + (r = /[\u0000]+/.exec("\\u\0")) && r[0], 1.136 + "Section 21" 1.137 +); 1.138 + 1.139 +reportCompare( 1.140 + "0\0", 1.141 + (r = /[\u00000]+/.exec("0\0")) && r[0], 1.142 + "Section 22" 1.143 +); 1.144 + 1.145 +reportCompare( 1.146 + "u", 1.147 + (r = /^\u$/.exec("u")) && r[0], 1.148 + "Section 23" 1.149 +); 1.150 + 1.151 +reportCompare( 1.152 + "uy", 1.153 + (r = /^\uy$/.exec("uy")) && r[0], 1.154 + "Section 24" 1.155 +); 1.156 + 1.157 +reportCompare( 1.158 + "u0", 1.159 + (r = /^\u0$/.exec("u0")) && r[0], 1.160 + "Section 25" 1.161 +); 1.162 + 1.163 +reportCompare( 1.164 + "u00", 1.165 + (r = /^\u00$/.exec("u00")) && r[0], 1.166 + "Section 26" 1.167 +); 1.168 + 1.169 +reportCompare( 1.170 + "u000", 1.171 + (r = /^\u000$/.exec("u000")) && r[0], 1.172 + "Section 27" 1.173 +); 1.174 + 1.175 +reportCompare( 1.176 + "u0y", 1.177 + (r = /^\u0y$/.exec("u0y")) && r[0], 1.178 + "Section 28" 1.179 +); 1.180 + 1.181 +reportCompare( 1.182 + "u00y", 1.183 + (r = /^\u00y$/.exec("u00y")) && r[0], 1.184 + "Section 29" 1.185 +); 1.186 + 1.187 +reportCompare( 1.188 + "u000y", 1.189 + (r = /^\u000y$/.exec("u000y")) && r[0], 1.190 + "Section 30" 1.191 +); 1.192 + 1.193 +reportCompare( 1.194 + null, 1.195 + /^\u0000$/.exec("\0" + "0"), 1.196 + "Section 31" 1.197 +); 1.198 + 1.199 +reportCompare( 1.200 + "\0" + "0", 1.201 + (r = /^\u00000$/.exec("\0" + "0")) && r[0], 1.202 + "Section 32" 1.203 +);