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

Side by Side Diff: test/mjsunit/string-indexof-2.js

Issue 7826007: Added check for trailing whitespaces and corrected existing violations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Yet another iteration. Created 9 years, 3 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-indexof-1.js ('k') | test/mjsunit/string-slices.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 assertEquals(893, lipsum.indexOf("lorem ipsum, quia dolor sit, amet"), 51 assertEquals(893, lipsum.indexOf("lorem ipsum, quia dolor sit, amet"),
52 "Lipsum"); 52 "Lipsum");
53 // test a lot of substrings of differing length and start-position. 53 // test a lot of substrings of differing length and start-position.
54 for(var i = 0; i < lipsum.length; i += 3) { 54 for(var i = 0; i < lipsum.length; i += 3) {
55 for(var len = 1; i + len < lipsum.length; len += 7) { 55 for(var len = 1; i + len < lipsum.length; len += 7) {
56 var substring = lipsum.substring(i, i + len); 56 var substring = lipsum.substring(i, i + len);
57 var index = -1; 57 var index = -1;
58 do { 58 do {
59 index = lipsum.indexOf(substring, index + 1); 59 index = lipsum.indexOf(substring, index + 1);
60 assertTrue(index != -1, 60 assertTrue(index != -1,
61 "Lipsum substring " + i + ".." + (i + len-1) + " not found"); 61 "Lipsum substring " + i + ".." + (i + len-1) + " not found");
62 assertEquals(lipsum.substring(index, index + len), substring, 62 assertEquals(lipsum.substring(index, index + len), substring,
63 "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" + 63 "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" +
64 index + ".." + (index + len - 1)); 64 index + ".." + (index + len - 1));
65 } while (index >= 0 && index < i); 65 } while (index >= 0 && index < i);
66 assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1)); 66 assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1));
67 } 67 }
68 } 68 }
OLDNEW
« no previous file with comments | « test/mjsunit/string-indexof-1.js ('k') | test/mjsunit/string-slices.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698