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

Unified Diff: test/mjsunit/debug-liveedit-diff.js

Issue 6017008: Add fine-grained diff implementation to LiveEdit engine. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/debug-liveedit-newsource.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-liveedit-diff.js
diff --git a/test/mjsunit/debug-liveedit-diff.js b/test/mjsunit/debug-liveedit-diff.js
index 7edf704f7b21e539a50518854279aca836c26c2f..0d26a30b409a07480449091cbd1128414ff2a620 100644
--- a/test/mjsunit/debug-liveedit-diff.js
+++ b/test/mjsunit/debug-liveedit-diff.js
@@ -31,11 +31,15 @@
Debug = debug.Debug
function CheckCompareOneWay(s1, s2) {
- var diff_array = Debug.LiveEdit.TestApi.CompareStringsLinewise(s1, s2);
+ var diff_array = Debug.LiveEdit.TestApi.CompareStrings(s1, s2);
var pos1 = 0;
var pos2 = 0;
print("Compare:");
+ print("s1='" + s1 + "'");
+ print("s2='" + s2 + "'");
+ print("Diff:");
+ print("" + diff_array);
for (var i = 0; i < diff_array.length; i += 3) {
var similar_length = diff_array[i] - pos1;
assertEquals(s1.substring(pos1, pos1 + similar_length),
@@ -45,12 +49,12 @@ function CheckCompareOneWay(s1, s2) {
pos1 += similar_length;
pos2 += similar_length;
print("<<< " + pos1 + " " + diff_array[i + 1]);
- print(s1.substring(pos1, pos1 + diff_array[i + 1]));
+ print(s1.substring(pos1, diff_array[i + 1]));
print("===");
- print(s2.substring(pos2, pos2 + diff_array[i + 2]));
+ print(s2.substring(pos2, diff_array[i + 2]));
print(">>> " + pos2 + " " + diff_array[i + 2]);
- pos1 += diff_array[i + 1];
- pos2 += diff_array[i + 2];
+ pos1 = diff_array[i + 1];
+ pos2 = diff_array[i + 2];
}
{
// After last change
@@ -64,9 +68,18 @@ function CheckCompareOneWay(s1, s2) {
print("");
}
-function CheckCompare(s1, s2) {
+function CheckCompareOneWayPlayWithLF(s1, s2) {
+ var s1Oneliner = s1.replace(/\n/g, ' ');
+ var s2Oneliner = s2.replace(/\n/g, ' ');
CheckCompareOneWay(s1, s2);
- CheckCompareOneWay(s2, s1);
+ CheckCompareOneWay(s1Oneliner, s2);
+ CheckCompareOneWay(s1, s2Oneliner);
+ CheckCompareOneWay(s1Oneliner, s2Oneliner);
+}
+
+function CheckCompare(s1, s2) {
+ CheckCompareOneWayPlayWithLF(s1, s2);
+ CheckCompareOneWayPlayWithLF(s2, s1);
}
CheckCompare("", "");
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/debug-liveedit-newsource.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698