Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4298 const char* context_data[][2] = {{"", ""}, | 4298 const char* context_data[][2] = {{"", ""}, |
| 4299 {"'use strict';", ""}, | 4299 {"'use strict';", ""}, |
| 4300 {NULL, NULL}}; | 4300 {NULL, NULL}}; |
| 4301 const char* data[] = { | 4301 const char* data[] = { |
| 4302 "var foob\\u123r = 0;", | 4302 "var foob\\u123r = 0;", |
| 4303 "var \\u123roo = 0;", | 4303 "var \\u123roo = 0;", |
| 4304 "\"foob\\u123rr\"", | 4304 "\"foob\\u123rr\"", |
| 4305 // No escapes allowed in regexp flags | 4305 // No escapes allowed in regexp flags |
| 4306 "/regex/\\u0069g", | 4306 "/regex/\\u0069g", |
| 4307 "/regex/\\u006g", | 4307 "/regex/\\u006g", |
| 4308 // Braces gone wrong | |
| 4309 "var foob\\u{c481r = 0;", | |
| 4310 "var foob\\uc481}r = 0;", | |
| 4311 "var foob\\u{c4}r = 0;", | |
| 4312 "var \\u{0052oo = 0;", | |
| 4313 "var \\u0052}oo = 0;", | |
| 4314 "var \\u{00}oo = 0;", | |
| 4315 "\"foob\\u{c481r\"", | |
| 4316 "\"foob\\u{c4}r\"", | |
|
arv (Not doing code reviews)
2014/11/07 16:23:20
Can you add a test for
http://people.mozilla.org
marja
2014/11/13 11:53:20
Done.
| |
| 4308 NULL}; | 4317 NULL}; |
| 4309 RunParserSyncTest(context_data, data, kError); | 4318 RunParserSyncTest(context_data, data, kError); |
| 4310 } | 4319 } |
| 4320 | |
| 4321 | |
| 4322 TEST(UnicodeEscapes) { | |
| 4323 const char* context_data[][2] = {{"", ""}, | |
| 4324 {"'use strict';", ""}, | |
| 4325 {NULL, NULL}}; | |
| 4326 const char* data[] = { | |
| 4327 // Identifier starting with escape | |
| 4328 "var \\u0052oo = 0;", | |
| 4329 "var \\u{0052}oo = 0;", | |
| 4330 // Identifier with an escape but not starting with an escape | |
| 4331 "var foob\\uc481r = 0;", | |
| 4332 "var foob\\u{c481}r = 0;", | |
| 4333 // String with an escape | |
| 4334 "\"foob\\uc481r\"", | |
| 4335 "\"foob\\{uc481}r\"", | |
| 4336 // Regexp body | |
| 4337 "/(\\u0066|\\u0062)oo/", | |
| 4338 "/(\\u{0066}|\\u{0062})oo/", | |
| 4339 "/[\\u0062-\\u0066]oo/", | |
| 4340 "/[\\u{0062}-\\u{0066}]oo/", | |
| 4341 // If the { cannot be matched, the escape is only \u and the rest is | |
| 4342 // not part of the escape. | |
| 4343 "/(\\u{0066|\\u{0062)oo/", | |
| 4344 "/[\\u{0062-\\u{0066 ]oo/", | |
|
arv (Not doing code reviews)
2014/11/07 16:23:20
Can you add a test with more than 4 hex numbers?
marja
2014/11/13 11:53:20
Done.
| |
| 4345 NULL}; | |
| 4346 RunParserSyncTest(context_data, data, kSuccess); | |
| 4347 } | |
| OLD | NEW |