Skip to content

Commit 4a33392

Browse files
author
Bryan C. Mills
committed
cmd/go/internal/mvs: test a downgrade where the target explicitly requires itself
Also clean up the test assertions, and add a check for assertions missing function invocations (there was one). For #37438 Change-Id: Iafbfeae2c25217eac894181e01480b25b7cffbd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/266859 Trust: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 0c86172 commit 4a33392

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

src/cmd/go/internal/mvs/mvs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]mod
342342
}
343343

344344
// Downgrade returns a build list for the target module
345-
// in which the given additional modules are downgraded.
345+
// in which the given additional modules are downgraded,
346+
// potentially overriding the requirements of the target.
346347
//
347348
// The versions to be downgraded may be unreachable from reqs.Latest and
348349
// reqs.Previous, but the methods of reqs must otherwise handle such versions

src/cmd/go/internal/mvs/mvs_test.go

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ build A: A B C D2 E2
5454
5555
name: cross1V
5656
A: B2 C D2 E1
57-
B1:
57+
B1:
5858
B2: D1
5959
C: D2
6060
D1: E2
@@ -63,7 +63,7 @@ build A: A B2 C D2 E2
6363
6464
name: cross1U
6565
A: B1 C
66-
B1:
66+
B1:
6767
B2: D1
6868
C: D2
6969
D1: E2
@@ -72,7 +72,7 @@ build A: A B1 C D2 E1
7272
upgrade A B2: A B2 C D2 E2
7373
7474
name: cross1R
75-
A: B C
75+
A: B C
7676
B: D2
7777
C: D1
7878
D1: E2
@@ -165,7 +165,7 @@ M: A1 B1
165165
A1: X1
166166
B1: X2
167167
X1: I1
168-
X2:
168+
X2:
169169
build M: M A1 B1 I1 X2
170170
171171
# Upgrade from B1 to B2 should not drop the transitive dep on D.
@@ -229,28 +229,31 @@ E1:
229229
F1:
230230
downgrade A F1: A B1 E1
231231
232-
name: down3
233-
A:
232+
name: downcycle
233+
A: A B2
234+
B2: A
235+
B1:
236+
downgrade A B1: A B1
234237
235238
# golang.org/issue/25542.
236239
name: noprev1
237240
A: B4 C2
238-
B2.hidden:
239-
C2:
241+
B2.hidden:
242+
C2:
240243
downgrade A B2.hidden: A B2.hidden C2
241244
242245
name: noprev2
243246
A: B4 C2
244-
B2.hidden:
245-
B1:
246-
C2:
247+
B2.hidden:
248+
B1:
249+
C2:
247250
downgrade A B2.hidden: A B2.hidden C2
248251
249252
name: noprev3
250253
A: B4 C2
251-
B3:
252-
B2.hidden:
253-
C2:
254+
B3:
255+
B2.hidden:
256+
C2:
254257
downgrade A B2.hidden: A B2.hidden C2
255258
256259
# Cycles involving the target.
@@ -315,7 +318,7 @@ M: A1 B1
315318
A1: X1
316319
B1: X2
317320
X1: I1
318-
X2:
321+
X2:
319322
req M: A1 B1
320323
321324
name: reqnone
@@ -338,6 +341,9 @@ func Test(t *testing.T) {
338341
for _, fn := range fns {
339342
fn(t)
340343
}
344+
if len(fns) == 0 {
345+
t.Errorf("no functions tested")
346+
}
341347
})
342348
}
343349
}

0 commit comments

Comments
 (0)