| 1 | // Copyright 2019 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package difftest supplies a set of tests that will operate on any |
| 6 | // implementation of a diff algorithm as exposed by |
| 7 | // "golang.org/x/tools/internal/diff" |
| 8 | package difftestscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/ |
| 9 | |
| 10 | // There are two kinds of tests, semantic tests, and 'golden data' tests. |
| 11 | // The semantic tests check that the computed diffs transform the input to |
| 12 | // the output, and that 'patch' accepts the computed unified diffs. |
| 13 | // The other tests just check that Edits and LineEdits haven't changed |
| 14 | // unexpectedly. These fields may need to be changed when the diff algorithm |
| 15 | // changes. |
| 16 | |
| 17 | import ( |
| 18 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 19 | |
| 20 | "golang.org/x/tools/internal/diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/" |
| 21 | ) |
| 22 | |
| 23 | const ( |
| 24 | FileAscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileA. = "from" |
| 25 | FileBscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileB. = "to" |
| 26 | UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. = "--- " + FileAscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileA. + "\n+++ " + FileBscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileB. + "\n" |
| 27 | ) |
| 28 | |
| 29 | var TestCasesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases. = []struct { |
| 30 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name., Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In., Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out., Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified. string |
| 31 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits., LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits. []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit# // expectation (LineEdits=nil => already line-aligned) |
| 32 | NoDiffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:NoDiff. bool |
| 33 | }{{ |
| 34 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "empty", |
| 35 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "", |
| 36 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "", |
| 37 | }, { |
| 38 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "no_diff", |
| 39 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "gargantuan\n", |
| 40 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "gargantuan\n", |
| 41 | }, { |
| 42 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "replace_all", |
| 43 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "fruit\n", |
| 44 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "cheese\n", |
| 45 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 46 | @@ -1 +1 @@ |
| 47 | -fruit |
| 48 | +cheese |
| 49 | `[1:], |
| 50 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 5, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "cheese"}}, |
| 51 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 6, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "cheese\n"}}, |
| 52 | }, { |
| 53 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "insert_rune", |
| 54 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "gord\n", |
| 55 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "gourd\n", |
| 56 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 57 | @@ -1 +1 @@ |
| 58 | -gord |
| 59 | +gourd |
| 60 | `[1:], |
| 61 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 2, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 2, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "u"}}, |
| 62 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 5, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "gourd\n"}}, |
| 63 | }, { |
| 64 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "delete_rune", |
| 65 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "groat\n", |
| 66 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "goat\n", |
| 67 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 68 | @@ -1 +1 @@ |
| 69 | -groat |
| 70 | +goat |
| 71 | `[1:], |
| 72 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 1, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 2, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}}, |
| 73 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 6, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "goat\n"}}, |
| 74 | }, { |
| 75 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "replace_rune", |
| 76 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "loud\n", |
| 77 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "lord\n", |
| 78 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 79 | @@ -1 +1 @@ |
| 80 | -loud |
| 81 | +lord |
| 82 | `[1:], |
| 83 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 2, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 3, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "r"}}, |
| 84 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 5, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "lord\n"}}, |
| 85 | }, { |
| 86 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "replace_partials", |
| 87 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "blanket\n", |
| 88 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "bunker\n", |
| 89 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 90 | @@ -1 +1 @@ |
| 91 | -blanket |
| 92 | +bunker |
| 93 | `[1:], |
| 94 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{ |
| 95 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 1, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 3, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "u"}, |
| 96 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 6, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 7, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "r"}, |
| 97 | }, |
| 98 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 8, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "bunker\n"}}, |
| 99 | }, { |
| 100 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "insert_line", |
| 101 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "1: one\n3: three\n", |
| 102 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "1: one\n2: two\n3: three\n", |
| 103 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 104 | @@ -1,2 +1,3 @@ |
| 105 | 1: one |
| 106 | +2: two |
| 107 | 3: three |
| 108 | `[1:], |
| 109 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 7, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 7, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "2: two\n"}}, |
| 110 | }, { |
| 111 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "replace_no_newline", |
| 112 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A", |
| 113 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "B", |
| 114 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 115 | @@ -1 +1 @@ |
| 116 | -A |
| 117 | \ No newline at end of file |
| 118 | +B |
| 119 | \ No newline at end of file |
| 120 | `[1:], |
| 121 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "B"}}, |
| 122 | }, { |
| 123 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "delete_empty", |
| 124 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "meow", |
| 125 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "", // GNU diff -u special case: +0,0 |
| 126 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 127 | @@ -1 +0,0 @@ |
| 128 | -meow |
| 129 | \ No newline at end of file |
| 130 | `[1:], |
| 131 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 4, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}}, |
| 132 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 4, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}}, |
| 133 | }, { |
| 134 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "append_empty", |
| 135 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "", // GNU diff -u special case: -0,0 |
| 136 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "AB\nC", |
| 137 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 138 | @@ -0,0 +1,2 @@ |
| 139 | +AB |
| 140 | +C |
| 141 | \ No newline at end of file |
| 142 | `[1:], |
| 143 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 0, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "AB\nC"}}, |
| 144 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 0, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "AB\nC"}}, |
| 145 | }, |
| 146 | // TODO(adonovan): fix this test: GNU diff -u prints "+1,2", Unifies prints "+1,3". |
| 147 | // { |
| 148 | // Name: "add_start", |
| 149 | // In: "A", |
| 150 | // Out: "B\nCA", |
| 151 | // Unified: UnifiedPrefix + ` |
| 152 | // @@ -1 +1,2 @@ |
| 153 | // -A |
| 154 | // \ No newline at end of file |
| 155 | // +B |
| 156 | // +CA |
| 157 | // \ No newline at end of file |
| 158 | // `[1:], |
| 159 | // Edits: []diff.TextEdit{{Span: newSpan(0, 0), NewText: "B\nC"}}, |
| 160 | // LineEdits: []diff.TextEdit{{Span: newSpan(0, 0), NewText: "B\nC"}}, |
| 161 | // }, |
| 162 | { |
| 163 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "add_end", |
| 164 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A", |
| 165 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "AB", |
| 166 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 167 | @@ -1 +1 @@ |
| 168 | -A |
| 169 | \ No newline at end of file |
| 170 | +AB |
| 171 | \ No newline at end of file |
| 172 | `[1:], |
| 173 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 1, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "B"}}, |
| 174 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "AB"}}, |
| 175 | }, { |
| 176 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "add_empty", |
| 177 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "", |
| 178 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "AB\nC", |
| 179 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 180 | @@ -0,0 +1,2 @@ |
| 181 | +AB |
| 182 | +C |
| 183 | \ No newline at end of file |
| 184 | `[1:], |
| 185 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 0, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "AB\nC"}}, |
| 186 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 0, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "AB\nC"}}, |
| 187 | }, { |
| 188 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "add_newline", |
| 189 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A", |
| 190 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "A\n", |
| 191 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 192 | @@ -1 +1 @@ |
| 193 | -A |
| 194 | \ No newline at end of file |
| 195 | +A |
| 196 | `[1:], |
| 197 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 1, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "\n"}}, |
| 198 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "A\n"}}, |
| 199 | }, { |
| 200 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "delete_front", |
| 201 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A\nB\nC\nA\nB\nB\nA\n", |
| 202 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "C\nB\nA\nB\nA\nC\n", |
| 203 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 204 | @@ -1,7 +1,6 @@ |
| 205 | -A |
| 206 | +C |
| 207 | B |
| 208 | -C |
| 209 | A |
| 210 | -B |
| 211 | B |
| 212 | A |
| 213 | +C |
| 214 | `[1:], |
| 215 | NoDiffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:NoDiff.: true, // unified diff is different but valid |
| 216 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{ |
| 217 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 2, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n"}, |
| 218 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 4, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 6, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}, |
| 219 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 8, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 10, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}, |
| 220 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 14, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 14, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n"}, |
| 221 | }, |
| 222 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{ |
| 223 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 2, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n"}, |
| 224 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 4, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 6, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}, |
| 225 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 8, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 10, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}, |
| 226 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 14, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 14, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n"}, |
| 227 | }, |
| 228 | }, { |
| 229 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "replace_last_line", |
| 230 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A\nB\n", |
| 231 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "A\nC\n\n", |
| 232 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 233 | @@ -1,2 +1,3 @@ |
| 234 | A |
| 235 | -B |
| 236 | +C |
| 237 | + |
| 238 | `[1:], |
| 239 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 2, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 3, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n"}}, |
| 240 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 2, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 4, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "C\n\n"}}, |
| 241 | }, |
| 242 | { |
| 243 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "multiple_replace", |
| 244 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "A\nB\nC\nD\nE\nF\nG\n", |
| 245 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "A\nH\nI\nJ\nE\nF\nK\n", |
| 246 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + ` |
| 247 | @@ -1,7 +1,7 @@ |
| 248 | A |
| 249 | -B |
| 250 | -C |
| 251 | -D |
| 252 | +H |
| 253 | +I |
| 254 | +J |
| 255 | E |
| 256 | F |
| 257 | -G |
| 258 | +K |
| 259 | `[1:], |
| 260 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{ |
| 261 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 2, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 8, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "H\nI\nJ\n"}, |
| 262 | {Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 12, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 14, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "K\n"}, |
| 263 | }, |
| 264 | NoDiffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:NoDiff.: true, // diff algorithm produces different delete/insert pattern |
| 265 | }, |
| 266 | { |
| 267 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "extra_newline", |
| 268 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "\nA\n", |
| 269 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "A\n", |
| 270 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 0, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 1, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: ""}}, |
| 271 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + `@@ -1,2 +1 @@ |
| 272 | - |
| 273 | A |
| 274 | `, |
| 275 | }, { |
| 276 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "unified_lines", |
| 277 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: "aaa\nccc\n", |
| 278 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: "aaa\nbbb\nccc\n", |
| 279 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 4, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 4, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "bbb\n"}}, |
| 280 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 4, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 4, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "bbb\n"}}, |
| 281 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + "@@ -1,2 +1,3 @@\n aaa\n+bbb\n ccc\n", |
| 282 | }, { |
| 283 | Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name.: "60379", |
| 284 | Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In.: `package a |
| 285 | |
| 286 | type S struct { |
| 287 | s fmt.Stringer |
| 288 | } |
| 289 | `, |
| 290 | Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.: `package a |
| 291 | |
| 292 | type S struct { |
| 293 | s fmt.Stringer |
| 294 | } |
| 295 | `, |
| 296 | Editsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Edits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 27, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 27, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "\t"}}, |
| 297 | LineEditsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:LineEdits.: []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#{{Startscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#Start.: 27, Endscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#End.: 42, Newscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#New.: "\ts fmt.Stringer\n"}}, |
| 298 | Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified.: UnifiedPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/UnifiedPrefix. + "@@ -1,5 +1,5 @@\n package a\n \n type S struct {\n-s fmt.Stringer\n+\ts fmt.Stringer\n }\n", |
| 299 | }, |
| 300 | } |
| 301 | |
| 302 | func DiffTestscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/DiffTest().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, compute func(before, after string) []diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Editscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Edit#) { |
| 303 | for _, test := range TestCasesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases. { |
| 304 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(test.Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Name., func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 305 | edits := compute(test.Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In., test.Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.) |
| 306 | got, err := diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.Applyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/Apply().(test.Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In., edits) |
| 307 | if err != nil { |
| 308 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("Apply failed: %v", err) |
| 309 | } |
| 310 | unified, err := diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.ToUnifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/ToUnified().(FileAscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileA., FileBscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/FileB., test.Inscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:In., edits, diffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/.DefaultContextLinesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff`/DefaultContextLines.) |
| 311 | if err != nil { |
| 312 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ToUnified: %v", err) |
| 313 | } |
| 314 | if got != test.Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out. { |
| 315 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Apply: got patched:\n%v\nfrom diff:\n%v\nexpected:\n%v", |
| 316 | got, unified, test.Outscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Out.) |
| 317 | } |
| 318 | if !test.NoDiffscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:NoDiff. && unified != test.Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified. { |
| 319 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Unified: got diff:\n%q\nexpected:\n%q diffs:%v", |
| 320 | unified, test.Unifiedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/diff/difftest`/TestCases:Unified., edits) |
| 321 | } |
| 322 | }) |
| 323 | } |
| 324 | } |