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

Side by Side Diff: test/mjsunit/string-index.js

Issue 6869007: Cleanup of mjsunit.js code and make assertEquals more strict. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 8 months 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/string-fromcharcode.js ('k') | test/mjsunit/third_party/object-keys.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 foo[0] = "f"; 55 foo[0] = "f";
56 assertEquals("Foo", foo); 56 assertEquals("Foo", foo);
57 57
58 foo[3] = "t"; 58 foo[3] = "t";
59 assertEquals("Foo", foo); 59 assertEquals("Foo", foo);
60 assertEquals("undefined", typeof(foo[3]), "out of range"); 60 assertEquals("undefined", typeof(foo[3]), "out of range");
61 assertEquals("undefined", typeof(foo[-2]), "negative index"); 61 assertEquals("undefined", typeof(foo[-2]), "negative index");
62 62
63 var S = new String("foo"); 63 var S = new String("foo");
64 assertEquals("foo", S); 64 assertEquals(Object("foo"), S);
65 assertEquals("f", S[0], "string object"); 65 assertEquals("f", S[0], "string object");
66 assertEquals("f", S["0"], "string object"); 66 assertEquals("f", S["0"], "string object");
67 S[0] = 'bente'; 67 S[0] = 'bente';
68 assertEquals("f", S[0], "string object"); 68 assertEquals("f", S[0], "string object");
69 assertEquals("f", S["0"], "string object"); 69 assertEquals("f", S["0"], "string object");
70 S[-2] = 'spider'; 70 S[-2] = 'spider';
71 assertEquals('spider', S[-2]); 71 assertEquals('spider', S[-2]);
72 S[3] = 'monkey'; 72 S[3] = 'monkey';
73 assertEquals('monkey', S[3]); 73 assertEquals('monkey', S[3]);
74 S['foo'] = 'Fu'; 74 S['foo'] = 'Fu';
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 //assertEquals(false, "-1" in "foo", '"-1" in'); 124 //assertEquals(false, "-1" in "foo", '"-1" in');
125 //assertEquals(true, "2" in "foo", '"2" in'); 125 //assertEquals(true, "2" in "foo", '"2" in');
126 //assertEquals(false, "3" in "foo", '"3" in'); 126 //assertEquals(false, "3" in "foo", '"3" in');
127 127
128 delete S[3]; 128 delete S[3];
129 assertEquals("undefined", typeof(S[3])); 129 assertEquals("undefined", typeof(S[3]));
130 assertEquals(false, 3 in S); 130 assertEquals(false, 3 in S);
131 assertEquals(false, "3" in S); 131 assertEquals(false, "3" in S);
132 132
133 var N = new Number(43); 133 var N = new Number(43);
134 assertEquals(43, N); 134 assertEquals(Object(43), N);
135 N[-2] = "Alpha"; 135 N[-2] = "Alpha";
136 assertEquals("Alpha", N[-2]); 136 assertEquals("Alpha", N[-2]);
137 N[0] = "Zappa"; 137 N[0] = "Zappa";
138 assertEquals("Zappa", N[0]); 138 assertEquals("Zappa", N[0]);
139 assertEquals("Zappa", N["0"]); 139 assertEquals("Zappa", N["0"]);
140 140
141 var A = ["V", "e", "t", "t", "e", "r"]; 141 var A = ["V", "e", "t", "t", "e", "r"];
142 var A2 = (A[0] = "v"); 142 var A2 = (A[0] = "v");
143 assertEquals('v', A[0]); 143 assertEquals('v', A[0]);
144 assertEquals('v', A2); 144 assertEquals('v', A2);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 assertEquals(expected, actual); 250 assertEquals(expected, actual);
251 } 251 }
252 252
253 // Test two byte string. 253 // Test two byte string.
254 var str = '\u0427', arr = ['\u0427']; 254 var str = '\u0427', arr = ['\u0427'];
255 for (var i = 0; i < 50; ++i) { 255 for (var i = 0; i < 50; ++i) {
256 var expected = arr[0]; 256 var expected = arr[0];
257 var actual = str[0]; 257 var actual = str[0];
258 assertEquals(expected, actual); 258 assertEquals(expected, actual);
259 } 259 }
OLDNEW
« no previous file with comments | « test/mjsunit/string-fromcharcode.js ('k') | test/mjsunit/third_party/object-keys.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698