]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/mvs: test a downgrade where the target explicitly requires itself
authorBryan C. Mills <bcmills@google.com>
Sat, 31 Oct 2020 01:47:32 +0000 (21:47 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 5 Nov 2020 16:47:29 +0000 (16:47 +0000)
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 <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/mvs/mvs.go
src/cmd/go/internal/mvs/mvs_test.go

index 3524a7a90eec557db9e3a38e22337e3a84a4e850..fe6d14e9dcb9aacf1a450907bf63405fbd07c388 100644 (file)
@@ -342,7 +342,8 @@ func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]mod
 }
 
 // Downgrade returns a build list for the target module
-// in which the given additional modules are downgraded.
+// in which the given additional modules are downgraded,
+// potentially overriding the requirements of the target.
 //
 // The versions to be downgraded may be unreachable from reqs.Latest and
 // reqs.Previous, but the methods of reqs must otherwise handle such versions
index f6f07b200eac3e6479048ea7b979e038ed118f40..af1bb216a7f9c59fd56cb5e0ae5548e2dca7773a 100644 (file)
@@ -54,7 +54,7 @@ build A: A B C D2 E2
 
 name: cross1V
 A: B2 C D2 E1
-B1: 
+B1:
 B2: D1
 C: D2
 D1: E2
@@ -63,7 +63,7 @@ build A: A B2 C D2 E2
 
 name: cross1U
 A: B1 C
-B1: 
+B1:
 B2: D1
 C: D2
 D1: E2
@@ -72,7 +72,7 @@ build A: A B1 C D2 E1
 upgrade A B2: A B2 C D2 E2
 
 name: cross1R
-A: B C 
+A: B C
 B: D2
 C: D1
 D1: E2
@@ -165,7 +165,7 @@ M: A1 B1
 A1: X1
 B1: X2
 X1: I1
-X2: 
+X2:
 build M: M A1 B1 I1 X2
 
 # Upgrade from B1 to B2 should not drop the transitive dep on D.
@@ -229,28 +229,31 @@ E1:
 F1:
 downgrade A F1: A B1 E1
 
-name: down3
-A: 
+name: downcycle
+A: A B2
+B2: A
+B1:
+downgrade A B1: A B1
 
 # golang.org/issue/25542.
 name: noprev1
 A: B4 C2
-B2.hidden: 
-C2: 
+B2.hidden:
+C2:
 downgrade A B2.hidden: A B2.hidden C2
 
 name: noprev2
 A: B4 C2
-B2.hidden: 
-B1: 
-C2: 
+B2.hidden:
+B1:
+C2:
 downgrade A B2.hidden: A B2.hidden C2
 
 name: noprev3
 A: B4 C2
-B3: 
-B2.hidden: 
-C2: 
+B3:
+B2.hidden:
+C2:
 downgrade A B2.hidden: A B2.hidden C2
 
 # Cycles involving the target.
@@ -315,7 +318,7 @@ M: A1 B1
 A1: X1
 B1: X2
 X1: I1
-X2: 
+X2:
 req M: A1 B1
 
 name: reqnone
@@ -338,6 +341,9 @@ func Test(t *testing.T) {
                                for _, fn := range fns {
                                        fn(t)
                                }
+                               if len(fns) == 0 {
+                                       t.Errorf("no functions tested")
+                               }
                        })
                }
        }