diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f1602318..00131cef 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1337,9 +1337,9 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==" }, "dot-prop": { "version": "4.2.1", @@ -1771,6 +1771,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -3659,6 +3665,14 @@ "diff": "^4.0.2", "nise": "^4.0.4", "supports-color": "^7.1.0" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } } }, "source-map": { @@ -3910,6 +3924,14 @@ "make-error": "^1.1.1", "source-map-support": "^0.5.17", "yn": "3.1.1" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } } }, "tslib": { @@ -3973,6 +3995,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", diff --git a/package.json b/package.json index f05ce301..82dce868 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "url": "git@github.com:SAP/ui5-migration.git" }, "dependencies": { - "diff": "^4.0.2", + "diff": "^5.0.0", "esprima": "^4.0.1", "globals": "^13.13.0", "graceful-fs": "^4.2.9", diff --git a/src/util/whitespace/DiffStringOptimizeStrategy.ts b/src/util/whitespace/DiffStringOptimizeStrategy.ts index bee6ccc4..cc8d49d6 100644 --- a/src/util/whitespace/DiffStringOptimizeStrategy.ts +++ b/src/util/whitespace/DiffStringOptimizeStrategy.ts @@ -58,12 +58,12 @@ export class DiffStringOptimizeStrategy implements StringOptimizeStrategy { aResult.forEach(oChange => { iIndex = sIgnoreWhitespaceChanges.length; if (oChange.removed === undefined && oChange.added === undefined) { + // neither added nor removed + // safely apply the changes sIgnoreWhitespaceChanges += oChange.value; } else if (oChange.added && oChange.removed === undefined) { - // add non-whitespace changes - if (!StringWhitespaceUtils.isWhitespace(oChange.value)) { - sIgnoreWhitespaceChanges += oChange.value; - } else { + // skip whitespaces + if (StringWhitespaceUtils.isWhitespace(oChange.value)) { if (this.reporter) { this.reporter.collect( "DiffStringOptimizeStrategy.skipped", @@ -76,6 +76,9 @@ export class DiffStringOptimizeStrategy implements StringOptimizeStrategy { )}` ); } + } else { + // add non-whitespace changes + sIgnoreWhitespaceChanges += oChange.value; } } else if (oChange.removed && oChange.added === undefined) { // add whitespace change if it was removed diff --git a/test/util/whitespace/DiffAndAstStringOptimizeStrategyTest.ts b/test/util/whitespace/DiffAndAstStringOptimizeStrategyTest.ts index 78ee9dea..8b2c6b52 100644 --- a/test/util/whitespace/DiffAndAstStringOptimizeStrategyTest.ts +++ b/test/util/whitespace/DiffAndAstStringOptimizeStrategyTest.ts @@ -9,45 +9,45 @@ const EOL_REGEXP = /\r?\n/g; describe("DiffAndAstStringOptimizeStrategy", function() { const aCommonLogs = [ - "trace: DIFF: Found 123 diffs", - "trace: DIFF Added 101: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 104: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 116: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 119: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 142: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 145: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 171: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 174: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 201: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 204: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 219: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 222: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 241: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 244: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 260: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 263: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 278: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 281: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 301: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 304: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 330: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 333: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 356: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 359: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 387: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 390: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 420: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 423: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 454: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 457: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 483: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 486: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 513: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 516: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 538: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 541: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 576: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 579: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF: Found 125 diffs", + "trace: DIFF Added 103: '[\\t]'", + "trace: DIFF Skipped 104: '[ ][ ][ ][ ]'", + "trace: DIFF Added 118: '[\\t]'", + "trace: DIFF Skipped 119: '[ ][ ][ ][ ]'", + "trace: DIFF Added 144: '[\\t]'", + "trace: DIFF Skipped 145: '[ ][ ][ ][ ]'", + "trace: DIFF Added 173: '[\\t]'", + "trace: DIFF Skipped 174: '[ ][ ][ ][ ]'", + "trace: DIFF Added 203: '[\\t]'", + "trace: DIFF Skipped 204: '[ ][ ][ ][ ]'", + "trace: DIFF Added 221: '[\\t]'", + "trace: DIFF Skipped 222: '[ ][ ][ ][ ]'", + "trace: DIFF Added 243: '[\\t]'", + "trace: DIFF Skipped 244: '[ ][ ][ ][ ]'", + "trace: DIFF Added 262: '[\\t]'", + "trace: DIFF Skipped 263: '[ ][ ][ ][ ]'", + "trace: DIFF Added 280: '[\\t]'", + "trace: DIFF Skipped 281: '[ ][ ][ ][ ]'", + "trace: DIFF Added 303: '[\\t]'", + "trace: DIFF Skipped 304: '[ ][ ][ ][ ]'", + "trace: DIFF Added 332: '[\\t]'", + "trace: DIFF Skipped 333: '[ ][ ][ ][ ]'", + "trace: DIFF Added 358: '[\\t]'", + "trace: DIFF Skipped 359: '[ ][ ][ ][ ]'", + "trace: DIFF Added 389: '[\\t]'", + "trace: DIFF Skipped 390: '[ ][ ][ ][ ]'", + "trace: DIFF Added 422: '[\\t]'", + "trace: DIFF Skipped 423: '[ ][ ][ ][ ]'", + "trace: DIFF Added 456: '[\\t]'", + "trace: DIFF Skipped 457: '[ ][ ][ ][ ]'", + "trace: DIFF Added 485: '[\\t]'", + "trace: DIFF Skipped 486: '[ ][ ][ ][ ]'", + "trace: DIFF Added 515: '[\\t]'", + "trace: DIFF Skipped 516: '[ ][ ][ ][ ]'", + "trace: DIFF Added 540: '[\\t]'", + "trace: DIFF Skipped 541: '[ ][ ][ ][ ]'", + "trace: DIFF Added 578: '[\\t]'", + "trace: DIFF Skipped 579: '[ ][ ][ ][ ]'", "trace: DIFF Added 651: '[ ]'", ]; @@ -72,8 +72,8 @@ describe("DiffAndAstStringOptimizeStrategy", function() { "trace: DIFF Skipped 703: '[\\r][\\n][\\t]'", "trace: DIFF Added 722: '[ ]'", "trace: DIFF Skipped 723: '[\\r][\\n][\\t]'", - "trace: DIFF Added 730: '[\\r][\\n][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", - "trace: DIFF Skipped 745: '[\\r][\\n][\\t]'", + "trace: DIFF Added 732: '[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", + "trace: DIFF Skipped 745: '[\\t]'", "trace: DIFF Added 756: '[ ]'", "trace: DIFF Skipped 757: '[\\r][\\n][\\t]'", "trace: DIFF Added 765: '[ ]'", @@ -88,8 +88,8 @@ describe("DiffAndAstStringOptimizeStrategy", function() { "trace: DIFF Skipped 798: '[\\r][\\n][\\t]'", "trace: DIFF Added 811: '[ ]'", "trace: DIFF Skipped 812: '[\\r][\\n][\\t]'", - "trace: DIFF Added 827: '[\\r][\\n][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", - "trace: DIFF Skipped 842: '[\\r][\\n][\\t]'", + "trace: DIFF Added 829: '[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", + "trace: DIFF Skipped 842: '[\\t]'", "trace: DIFF Added 858: '[ ]'", "trace: DIFF Skipped 859: '[\\r][\\n][\\t]'", "trace: DIFF Added 870: '[ ]'", @@ -129,8 +129,8 @@ describe("DiffAndAstStringOptimizeStrategy", function() { "trace: DIFF Skipped 703: '[\\r][\\n][\\t]'", "trace: DIFF Added 722: '[ ]'", "trace: DIFF Skipped 723: '[\\r][\\n][\\t]'", - "trace: DIFF Added 730: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Skipped 734: '[\\r][\\n][\\t]'", + "trace: DIFF Added 732: '[\\t][\\t]'", + "trace: DIFF Skipped 734: '[\\t]'", "trace: DIFF Added 745: '[ ]'", "trace: DIFF Skipped 746: '[\\r][\\n][\\t]'", "trace: DIFF Added 754: '[ ]'", @@ -145,8 +145,8 @@ describe("DiffAndAstStringOptimizeStrategy", function() { "trace: DIFF Skipped 787: '[\\r][\\n][\\t]'", "trace: DIFF Added 800: '[ ]'", "trace: DIFF Skipped 801: '[\\r][\\n][\\t]'", - "trace: DIFF Added 816: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Skipped 820: '[\\r][\\n][\\t]'", + "trace: DIFF Added 818: '[\\t][\\t]'", + "trace: DIFF Skipped 820: '[\\t]'", "trace: DIFF Added 836: '[ ]'", "trace: DIFF Skipped 837: '[\\r][\\n][\\t]'", "trace: DIFF Added 848: '[ ]'", @@ -214,11 +214,11 @@ describe("DiffAndAstStringOptimizeStrategy", function() { fileEOL: "\r\n", logs: [ "trace: Performing DiffStringOptimizeStrategy 189 and 93", - "trace: DIFF: Found 21 diffs", + "trace: DIFF: Found 22 diffs", "trace: DIFF Added 48: '[ ]'", - "trace: DIFF Added 89: '[\\r][\\n][\\r][\\n]'", - "trace: DIFF Skipped 93: '[\\r][\\n]'", - "trace: DIFF Added 96: '[\\r][\\n]'", + "trace: DIFF Added 81: '[\\r][\\n]'", + "trace: DIFF Added 93: '[\\r][\\n]'", + "trace: DIFF Added 98: '[\\r][\\n]'", "trace: Performing AstStringOptimizeStrategy", ], }, @@ -259,21 +259,21 @@ describe("DiffAndAstStringOptimizeStrategy", function() { logs: [ "trace: Performing DiffStringOptimizeStrategy 2226 and 2407", "trace: DIFF: Found 40 diffs", - "trace: DIFF Added 15: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 18: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 42: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 45: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 60: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 63: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 86: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 89: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 115: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 118: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 131: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 134: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF Added 17: '[\\t]'", + "trace: DIFF Skipped 18: '[ ][ ][ ][ ]'", + "trace: DIFF Added 44: '[\\t]'", + "trace: DIFF Skipped 45: '[ ][ ][ ][ ]'", + "trace: DIFF Added 62: '[\\t]'", + "trace: DIFF Skipped 63: '[ ][ ][ ][ ]'", + "trace: DIFF Added 88: '[\\t]'", + "trace: DIFF Skipped 89: '[ ][ ][ ][ ]'", + "trace: DIFF Added 117: '[\\t]'", + "trace: DIFF Skipped 118: '[ ][ ][ ][ ]'", + "trace: DIFF Added 133: '[\\t]'", + "trace: DIFF Skipped 134: '[ ][ ][ ][ ]'", "trace: DIFF Added 162: '[ ]'", - "trace: DIFF Added 230: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 233: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF Added 232: '[\\t]'", + "trace: DIFF Skipped 233: '[ ][ ][ ][ ]'", "trace: Performing AstStringOptimizeStrategy", ], }, @@ -283,21 +283,21 @@ describe("DiffAndAstStringOptimizeStrategy", function() { description: "multiple lines", logs: [ "trace: Performing DiffStringOptimizeStrategy 13025 and 13082", - "trace: DIFF: Found 53 diffs", - "trace: DIFF Added 41: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 44: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 77: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 80: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 128: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 131: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 165: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 168: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 200: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 203: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 232: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 235: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 432: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 435: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF: Found 55 diffs", + "trace: DIFF Added 43: '[\\t]'", + "trace: DIFF Skipped 44: '[ ][ ][ ][ ]'", + "trace: DIFF Added 79: '[\\t]'", + "trace: DIFF Skipped 80: '[ ][ ][ ][ ]'", + "trace: DIFF Added 130: '[\\t]'", + "trace: DIFF Skipped 131: '[ ][ ][ ][ ]'", + "trace: DIFF Added 167: '[\\t]'", + "trace: DIFF Skipped 168: '[ ][ ][ ][ ]'", + "trace: DIFF Added 202: '[\\t]'", + "trace: DIFF Skipped 203: '[ ][ ][ ][ ]'", + "trace: DIFF Added 234: '[\\t]'", + "trace: DIFF Skipped 235: '[ ][ ][ ][ ]'", + "trace: DIFF Added 434: '[\\t]'", + "trace: DIFF Skipped 435: '[ ][ ][ ][ ]'", "trace: Performing AstStringOptimizeStrategy", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][ ][ ][ ][ ]'", @@ -315,107 +315,101 @@ describe("DiffAndAstStringOptimizeStrategy", function() { description: "multiple lines in property", logs: [ "trace: Performing DiffStringOptimizeStrategy 10125 and 10441", - "trace: DIFF: Found 122 diffs", - "trace: DIFF Added 15: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 18: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 68: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 71: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 95: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 98: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 128: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 131: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 153: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 156: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 169: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 172: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 203: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 206: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 247: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 250: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 272: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 275: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 305: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 308: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 334: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 337: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 371: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 374: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 394: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 397: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 436: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 439: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 469: '[\\r][\\n][\\r][\\n]'", - "trace: DIFF Added 583: '[ ]'", - "trace: DIFF Skipped 585: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 600: '[ ]'", - "trace: DIFF Skipped 601: '[\\r][\\n][\\t]'", - "trace: DIFF Added 607: '[ ]'", - "trace: DIFF Skipped 608: '[\\r][\\n][\\t]'", - "trace: DIFF Added 618: '[ ]'", - "trace: DIFF Skipped 619: '[\\r][\\n][\\t]'", - "trace: DIFF Added 631: '[ ]'", - "trace: DIFF Skipped 632: '[\\r][\\n][\\t]'", - "trace: DIFF Added 637: '[ ]'", - "trace: DIFF Skipped 638: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 650: '[\\r][\\n][\\t]'", - "trace: DIFF Added 712: '[ ]'", - "trace: DIFF Skipped 713: '[\\r][\\n][\\t]'", - "trace: DIFF Added 728: '[ ]'", - "trace: DIFF Skipped 729: '[\\r][\\n][\\t]'", - "trace: DIFF Added 740: '[ ]'", - "trace: DIFF Skipped 741: '[\\r][\\n][\\t]'", - "trace: DIFF Added 751: '[ ]'", - "trace: DIFF Skipped 752: '[\\r][\\n][\\t]'", - "trace: DIFF Added 764: '[ ]'", - "trace: DIFF Skipped 765: '[\\r][\\n][\\t]'", - "trace: DIFF Added 781: '[ ]'", - "trace: DIFF Skipped 782: '[\\r][\\n][\\t]'", - "trace: DIFF Added 837: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 840: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 10365: '[\\r][\\n][\\r][\\n]'", - "trace: DIFF Skipped 10369: '[\\r][\\n]'", - "trace: DIFF Added 10372: '[\\r][\\n]'", + "trace: DIFF: Found 124 diffs", + "trace: DIFF Added 17: '[\\t]'", + "trace: DIFF Skipped 18: '[ ][ ][ ][ ]'", + "trace: DIFF Added 70: '[\\t]'", + "trace: DIFF Skipped 71: '[ ][ ][ ][ ]'", + "trace: DIFF Added 97: '[\\t]'", + "trace: DIFF Skipped 98: '[ ][ ][ ][ ]'", + "trace: DIFF Added 130: '[\\t]'", + "trace: DIFF Skipped 131: '[ ][ ][ ][ ]'", + "trace: DIFF Added 155: '[\\t]'", + "trace: DIFF Skipped 156: '[ ][ ][ ][ ]'", + "trace: DIFF Added 171: '[\\t]'", + "trace: DIFF Skipped 172: '[ ][ ][ ][ ]'", + "trace: DIFF Added 205: '[\\t]'", + "trace: DIFF Skipped 206: '[ ][ ][ ][ ]'", + "trace: DIFF Added 249: '[\\t]'", + "trace: DIFF Skipped 250: '[ ][ ][ ][ ]'", + "trace: DIFF Added 274: '[\\t]'", + "trace: DIFF Skipped 275: '[ ][ ][ ][ ]'", + "trace: DIFF Added 307: '[\\t]'", + "trace: DIFF Skipped 308: '[ ][ ][ ][ ]'", + "trace: DIFF Added 336: '[\\t]'", + "trace: DIFF Skipped 337: '[ ][ ][ ][ ]'", + "trace: DIFF Added 373: '[\\t]'", + "trace: DIFF Skipped 374: '[ ][ ][ ][ ]'", + "trace: DIFF Added 396: '[\\t]'", + "trace: DIFF Skipped 397: '[ ][ ][ ][ ]'", + "trace: DIFF Added 438: '[\\t]'", + "trace: DIFF Skipped 439: '[ ][ ][ ][ ]'", + "trace: DIFF Added 579: '[ ]'", + "trace: DIFF Skipped 581: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF Added 596: '[ ]'", + "trace: DIFF Skipped 597: '[\\r][\\n][\\t]'", + "trace: DIFF Added 603: '[ ]'", + "trace: DIFF Skipped 604: '[\\r][\\n][\\t]'", + "trace: DIFF Added 614: '[ ]'", + "trace: DIFF Skipped 615: '[\\r][\\n][\\t]'", + "trace: DIFF Added 627: '[ ]'", + "trace: DIFF Skipped 628: '[\\r][\\n][\\t]'", + "trace: DIFF Added 633: '[ ]'", + "trace: DIFF Skipped 634: '[\\r][\\n][\\t]'", + "trace: DIFF Skipped 646: '[\\r][\\n][\\t]'", + "trace: DIFF Added 708: '[ ]'", + "trace: DIFF Skipped 709: '[\\r][\\n][\\t]'", + "trace: DIFF Added 724: '[ ]'", + "trace: DIFF Skipped 725: '[\\r][\\n][\\t]'", + "trace: DIFF Added 736: '[ ]'", + "trace: DIFF Skipped 737: '[\\r][\\n][\\t]'", + "trace: DIFF Added 747: '[ ]'", + "trace: DIFF Skipped 748: '[\\r][\\n][\\t]'", + "trace: DIFF Added 760: '[ ]'", + "trace: DIFF Skipped 761: '[\\r][\\n][\\t]'", + "trace: DIFF Added 777: '[ ]'", + "trace: DIFF Skipped 778: '[\\r][\\n][\\t]'", + "trace: DIFF Added 835: '[\\t]'", + "trace: DIFF Skipped 836: '[ ][ ][ ][ ]'", + "trace: DIFF Added 10363: '[\\r][\\n]'", + "trace: DIFF Added 10368: '[\\r][\\n]'", "trace: Performing AstStringOptimizeStrategy", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][ ][ ][ ][ ]'", "trace: AST: add '[\\r][\\n][\\t]'", - "trace: AST: index: 479", + "trace: AST: index: 475", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][ ][ ][ ][ ]'", "trace: AST: add '[\\r][\\n][\\t]'", - "trace: AST: index: 507", + "trace: AST: index: 503", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][ ][ ][ ][ ]'", "trace: AST: add '[\\r][\\n][\\t]'", - "trace: AST: index: 540", - "trace: AST: whitespace diff for succeeding element", - "trace: AST: remove '[\\r][\\n][\\r][\\n]'", - "trace: AST: add '[]'", - "trace: AST: index: 469", + "trace: AST: index: 536", "trace: AST: whitespace diff for succeeding element", "trace: AST: remove '[\\r][\\n]'", "trace: AST: add '[\\r][\\n][\\r][\\n]'", - "trace: AST: index: 570", + "trace: AST: index: 566", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][\\t]'", "trace: AST: add '[ ]'", - "trace: AST: index: 684", + "trace: AST: index: 680", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][\\t]'", "trace: AST: add '[ ]'", - "trace: AST: index: 796", + "trace: AST: index: 792", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][\\t]'", "trace: AST: add '[ ]'", - "trace: AST: index: 811", + "trace: AST: index: 807", "trace: AST: whitespace diff for preceding element", "trace: AST: remove '[\\r][\\n][\\t]'", "trace: AST: add '[ ]'", - "trace: AST: index: 821", + "trace: AST: index: 817", "trace: AST: whitespace diff for succeeding element", "trace: AST: remove '[\\r][\\n]'", "trace: AST: add '[]'", - "trace: AST: index: 832", + "trace: AST: index: 828", ], }, ].forEach(oTestConfig => { diff --git a/test/util/whitespace/DiffStringOptimizeStrategyTest.ts b/test/util/whitespace/DiffStringOptimizeStrategyTest.ts index 296a8064..059cfbef 100644 --- a/test/util/whitespace/DiffStringOptimizeStrategyTest.ts +++ b/test/util/whitespace/DiffStringOptimizeStrategyTest.ts @@ -9,45 +9,45 @@ const EOL_REGEXP = /\r?\n/g; describe("DiffStringOptimizeStrategy", function() { const aCommonLogs = [ - "trace: DIFF: Found 123 diffs", - "trace: DIFF Added 101: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 104: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 116: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 119: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 142: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 145: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 171: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 174: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 201: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 204: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 219: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 222: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 241: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 244: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 260: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 263: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 278: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 281: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 301: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 304: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 330: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 333: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 356: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 359: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 387: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 390: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 420: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 423: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 454: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 457: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 483: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 486: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 513: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 516: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 538: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 541: '[\\r][\\n][ ][ ][ ][ ]'", - "trace: DIFF Added 576: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 579: '[\\r][\\n][ ][ ][ ][ ]'", + "trace: DIFF: Found 125 diffs", + "trace: DIFF Added 103: '[\\t]'", + "trace: DIFF Skipped 104: '[ ][ ][ ][ ]'", + "trace: DIFF Added 118: '[\\t]'", + "trace: DIFF Skipped 119: '[ ][ ][ ][ ]'", + "trace: DIFF Added 144: '[\\t]'", + "trace: DIFF Skipped 145: '[ ][ ][ ][ ]'", + "trace: DIFF Added 173: '[\\t]'", + "trace: DIFF Skipped 174: '[ ][ ][ ][ ]'", + "trace: DIFF Added 203: '[\\t]'", + "trace: DIFF Skipped 204: '[ ][ ][ ][ ]'", + "trace: DIFF Added 221: '[\\t]'", + "trace: DIFF Skipped 222: '[ ][ ][ ][ ]'", + "trace: DIFF Added 243: '[\\t]'", + "trace: DIFF Skipped 244: '[ ][ ][ ][ ]'", + "trace: DIFF Added 262: '[\\t]'", + "trace: DIFF Skipped 263: '[ ][ ][ ][ ]'", + "trace: DIFF Added 280: '[\\t]'", + "trace: DIFF Skipped 281: '[ ][ ][ ][ ]'", + "trace: DIFF Added 303: '[\\t]'", + "trace: DIFF Skipped 304: '[ ][ ][ ][ ]'", + "trace: DIFF Added 332: '[\\t]'", + "trace: DIFF Skipped 333: '[ ][ ][ ][ ]'", + "trace: DIFF Added 358: '[\\t]'", + "trace: DIFF Skipped 359: '[ ][ ][ ][ ]'", + "trace: DIFF Added 389: '[\\t]'", + "trace: DIFF Skipped 390: '[ ][ ][ ][ ]'", + "trace: DIFF Added 422: '[\\t]'", + "trace: DIFF Skipped 423: '[ ][ ][ ][ ]'", + "trace: DIFF Added 456: '[\\t]'", + "trace: DIFF Skipped 457: '[ ][ ][ ][ ]'", + "trace: DIFF Added 485: '[\\t]'", + "trace: DIFF Skipped 486: '[ ][ ][ ][ ]'", + "trace: DIFF Added 515: '[\\t]'", + "trace: DIFF Skipped 516: '[ ][ ][ ][ ]'", + "trace: DIFF Added 540: '[\\t]'", + "trace: DIFF Skipped 541: '[ ][ ][ ][ ]'", + "trace: DIFF Added 578: '[\\t]'", + "trace: DIFF Skipped 579: '[ ][ ][ ][ ]'", "trace: DIFF Added 651: '[ ]'", ]; @@ -72,8 +72,8 @@ describe("DiffStringOptimizeStrategy", function() { "trace: DIFF Skipped 703: '[\\r][\\n][\\t]'", "trace: DIFF Added 722: '[ ]'", "trace: DIFF Skipped 723: '[\\r][\\n][\\t]'", - "trace: DIFF Added 730: '[\\r][\\n][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", - "trace: DIFF Skipped 745: '[\\r][\\n][\\t]'", + "trace: DIFF Added 732: '[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", + "trace: DIFF Skipped 745: '[\\t]'", "trace: DIFF Added 756: '[ ]'", "trace: DIFF Skipped 757: '[\\r][\\n][\\t]'", "trace: DIFF Added 765: '[ ]'", @@ -88,8 +88,8 @@ describe("DiffStringOptimizeStrategy", function() { "trace: DIFF Skipped 798: '[\\r][\\n][\\t]'", "trace: DIFF Added 811: '[ ]'", "trace: DIFF Skipped 812: '[\\r][\\n][\\t]'", - "trace: DIFF Added 827: '[\\r][\\n][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", - "trace: DIFF Skipped 842: '[\\r][\\n][\\t]'", + "trace: DIFF Added 829: '[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]'", + "trace: DIFF Skipped 842: '[\\t]'", "trace: DIFF Added 858: '[ ]'", "trace: DIFF Skipped 859: '[\\r][\\n][\\t]'", "trace: DIFF Added 870: '[ ]'", @@ -116,8 +116,8 @@ describe("DiffStringOptimizeStrategy", function() { "trace: DIFF Skipped 703: '[\\r][\\n][\\t]'", "trace: DIFF Added 722: '[ ]'", "trace: DIFF Skipped 723: '[\\r][\\n][\\t]'", - "trace: DIFF Added 730: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Skipped 734: '[\\r][\\n][\\t]'", + "trace: DIFF Added 732: '[\\t][\\t]'", + "trace: DIFF Skipped 734: '[\\t]'", "trace: DIFF Added 745: '[ ]'", "trace: DIFF Skipped 746: '[\\r][\\n][\\t]'", "trace: DIFF Added 754: '[ ]'", @@ -132,8 +132,8 @@ describe("DiffStringOptimizeStrategy", function() { "trace: DIFF Skipped 787: '[\\r][\\n][\\t]'", "trace: DIFF Added 800: '[ ]'", "trace: DIFF Skipped 801: '[\\r][\\n][\\t]'", - "trace: DIFF Added 816: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Skipped 820: '[\\r][\\n][\\t]'", + "trace: DIFF Added 818: '[\\t][\\t]'", + "trace: DIFF Skipped 820: '[\\t]'", "trace: DIFF Added 836: '[ ]'", "trace: DIFF Skipped 837: '[\\r][\\n][\\t]'", "trace: DIFF Added 848: '[ ]'", @@ -174,7 +174,7 @@ describe("DiffStringOptimizeStrategy", function() { fileEOL: "\r\n", logs: [ "trace: Performing DiffStringOptimizeStrategy 179 and 83", - "trace: DIFF: Found 16 diffs", + "trace: DIFF: Found 18 diffs", "trace: DIFF Added 48: '[ ]'", "trace: DIFF Added 84: '[\\r][\\n]'", ], @@ -186,21 +186,21 @@ describe("DiffStringOptimizeStrategy", function() { "structural change by wrapping everything inside a sap.ui.define", logs: [ "trace: Performing DiffStringOptimizeStrategy 218 and 283", - "trace: DIFF: Found 26 diffs", - "trace: DIFF Added 55: '[\\r][\\n][ ]'", - "trace: DIFF Skipped 58: '[\\r][\\n][\\t][ ]'", - "trace: DIFF Added 103: '[\\r][\\n][ ]'", - "trace: DIFF Skipped 106: '[\\r][\\n][\\t][ ]'", - "trace: DIFF Added 107: '[\\r][\\n][ ]'", - "trace: DIFF Skipped 110: '[\\r][\\n][\\t][ ]'", - "trace: DIFF Added 112: '[\\r][\\n]'", - "trace: DIFF Skipped 114: '[\\r][\\n][\\t]'", - "trace: DIFF Added 132: '[\\r][\\n][\\t]'", - "trace: DIFF Skipped 135: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Added 177: '[\\r][\\n][\\t][\\t]'", - "trace: DIFF Skipped 181: '[\\r][\\n][\\t][\\t][\\t]'", - "trace: DIFF Added 248: '[\\r][\\n][\\r][\\n][\\t]'", - "trace: DIFF Skipped 253: '[\\r][\\n][\\r][\\n][\\t][\\t]'", + "trace: DIFF: Found 25 diffs", + "trace: DIFF Added 57: '[ ]'", + "trace: DIFF Skipped 58: '[\\t][ ]'", + "trace: DIFF Added 105: '[ ]'", + "trace: DIFF Skipped 106: '[\\t][ ]'", + "trace: DIFF Added 109: '[ ]'", + "trace: DIFF Skipped 110: '[\\t][ ]'", + "trace: DIFF Skipped 114: '[\\t]'", + "trace: DIFF Added 134: '[\\t]'", + "trace: DIFF Skipped 135: '[\\t][\\t]'", + "trace: DIFF Added 179: '[\\t][\\t]'", + "trace: DIFF Skipped 181: '[\\t][\\t][\\t]'", + "trace: DIFF Added 252: '[\\t]'", + "trace: DIFF Skipped 253: '[\\t][\\t]'", + "trace: DIFF Skipped 269: '[\\t]'", ], }, ].forEach(oTestConfig => { diff --git a/test/util/whitespace/diffandastresources/endless.expected.js b/test/util/whitespace/diffandastresources/endless.expected.js index 9091c139..04a61f98 100644 --- a/test/util/whitespace/diffandastresources/endless.expected.js +++ b/test/util/whitespace/diffandastresources/endless.expected.js @@ -2,6 +2,7 @@ sap.ui.define(["sap/ui2/srvc/utils"], function (utils) { "use strict"; + a(); }); diff --git a/test/util/whitespace/diffresources/structure.expected.js b/test/util/whitespace/diffresources/structure.expected.js index b59b1222..f2f80233 100644 --- a/test/util/whitespace/diffresources/structure.expected.js +++ b/test/util/whitespace/diffresources/structure.expected.js @@ -9,5 +9,5 @@ function suite() { sContextPath = window.location.pathname.split("test-resources")[0]; return oSuite; - } +} }); \ No newline at end of file