Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: test/mjsunit/escape.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/error-constructors.js ('k') | test/mjsunit/eval.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Check all chars up to 1000 in groups of 10 using unescape as a check 61 // Check all chars up to 1000 in groups of 10 using unescape as a check
62 for (var i = 0; i < 1000; i += 10) { 62 for (var i = 0; i < 1000; i += 10) {
63 var s = String.fromCharCode(i, i+1, i+2, i+3, i+4, i+5, i+6, i+7, i+8, i+9); 63 var s = String.fromCharCode(i, i+1, i+2, i+3, i+4, i+5, i+6, i+7, i+8, i+9);
64 assertEquals(s, unescape(escape(s))); 64 assertEquals(s, unescape(escape(s)));
65 } 65 }
66 66
67 // Benchmark 67 // Benchmark
68 var example = "Now is the time for all good men to come to the aid of the party. "; 68 var example = "Now is the time for all good men to come to the aid of the party. ";
69 example = example + String.fromCharCode(267, 0x1234, 0x6667, 0xabcd); 69 example = example + String.fromCharCode(267, 0x1234, 0x6667, 0xabcd);
70 example = example + " The quick brown fox jumps over the lazy dog." 70 example = example + " The quick brown fox jumps over the lazy dog.";
71 example = example + String.fromCharCode(171, 172, 173, 174, 175, 176, 178, 179); 71 example = example + String.fromCharCode(171, 172, 173, 174, 175, 176, 178, 179);
72 72
73 for (var i = 0; i < 3000; i++) { 73 for (var i = 0; i < 3000; i++) {
74 assertEquals(example, unescape(escape(example))); 74 assertEquals(example, unescape(escape(example)));
75 } 75 }
76 76
77 // Check unescape can cope with upper and lower case 77 // Check unescape can cope with upper and lower case
78 assertEquals(unescape("%41%4A%4a"), "AJJ"); 78 assertEquals(unescape("%41%4A%4a"), "AJJ");
79 79
80 // Check upper case U 80 // Check upper case U
(...skipping 28 matching lines...) Expand all
109 assertEquals("foo%u444<bar", unescape("foo%u444<bar")); 109 assertEquals("foo%u444<bar", unescape("foo%u444<bar"));
110 assertEquals("% ", unescape("%%20")); 110 assertEquals("% ", unescape("%%20"));
111 assertEquals("%% ", unescape("%%%20")); 111 assertEquals("%% ", unescape("%%%20"));
112 112
113 // Unescape stress 113 // Unescape stress
114 var eexample = escape(example); 114 var eexample = escape(example);
115 115
116 for (var i = 1; i < 3000; i++) { 116 for (var i = 1; i < 3000; i++) {
117 assertEquals(example, unescape(eexample)); 117 assertEquals(example, unescape(eexample));
118 } 118 }
OLDNEW
« no previous file with comments | « test/mjsunit/error-constructors.js ('k') | test/mjsunit/eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698