@@ -847,38 +847,56 @@ var bimodalFixtures = map[string]bimodalFixture{
847
847
),
848
848
},
849
849
"simple case-only variations plus source variance" : {
850
- // COPYPASTA BELOW, FIX IT
851
850
ds : []depspec {
852
851
dsp (mkDepspec ("root 0.0.0" ),
853
- pkg ("root" , "foo" , "Bar " )), // TODO align the froms
852
+ pkg ("root" , "foo" , "bar " )),
854
853
dsp (mkDepspec ("foo 1.0.0" , "Bar from quux 1.0.0" ),
855
854
pkg ("foo" , "Bar" )),
856
855
dsp (mkDepspec ("bar 1.0.0" ),
857
856
pkg ("bar" )),
858
857
dsp (mkDepspec ("quux 1.0.0" ),
859
858
pkg ("bar" )),
860
859
},
861
- r : mksolution (
862
- "foo 1.0.0" ,
863
- "Bar from quux 1.0.0" ,
864
- ),
860
+ fail : & noVersionError {
861
+ pn : mkPI ("foo" ),
862
+ fails : []failedVersion {
863
+ {
864
+ v : NewVersion ("1.0.0" ),
865
+ f : & caseMismatchFailure {
866
+ goal : mkDep ("foo 1.0.0" , "Bar from quux 1.0.0" , "Bar" ),
867
+ current : ProjectRoot ("bar" ),
868
+ failsib : []dependency {mkDep ("root" , "bar 1.0.0" , "bar" )},
869
+ },
870
+ },
871
+ },
872
+ },
865
873
},
866
874
"case-only variations plus source variance with internal canonicality" : {
867
- // COPYPASTA BELOW, FIX IT
868
875
ds : []depspec {
869
- dsp (mkDepspec ("root 0.0.0" ),
876
+ dsp (mkDepspec ("root 0.0.0" , "Bar from quux 1.0.0" ),
870
877
pkg ("root" , "foo" , "Bar" )),
871
878
dsp (mkDepspec ("foo 1.0.0" , "Bar from quux 1.0.0" ),
872
879
pkg ("foo" , "Bar" )),
873
880
dsp (mkDepspec ("bar 1.0.0" ),
874
- pkg ("bar" )),
881
+ pkg ("bar" , "bar/subpkg" ),
882
+ pkg ("bar/subpkg" )),
875
883
dsp (mkDepspec ("quux 1.0.0" ),
876
- pkg ("bar" )),
884
+ pkg ("bar" , "bar/subpkg" ),
885
+ pkg ("bar/subpkg" )),
886
+ },
887
+ fail : & noVersionError {
888
+ pn : mkPI ("Bar" ),
889
+ fails : []failedVersion {
890
+ {
891
+ v : NewVersion ("1.0.0" ),
892
+ f : & wrongCaseFailure {
893
+ correct : ProjectRoot ("bar" ),
894
+ goal : mkDep ("Bar from quux 1.0.0" , "bar 1.0.0" , "bar" ),
895
+ badcase : []dependency {mkDep ("root" , "Bar 1.0.0" , "Bar/subpkg" )},
896
+ },
897
+ },
898
+ },
877
899
},
878
- r : mksolution (
879
- "foo 1.0.0" ,
880
- "Bar from quux 1.0.0" ,
881
- ),
882
900
},
883
901
"alternate net address" : {
884
902
ds : []depspec {
@@ -1387,12 +1405,22 @@ func newbmSM(bmf bimodalFixture) *bmSourceManager {
1387
1405
}
1388
1406
1389
1407
func (sm * bmSourceManager ) ListPackages (id ProjectIdentifier , v Version ) (pkgtree.PackageTree , error ) {
1390
- src , fsrc := id .normalizedSource (), toFold (id .normalizedSource ())
1408
+ // Deal with address-based root-switching with both case folding and
1409
+ // alternate sources.
1410
+ var src , fsrc , root , froot string
1411
+ src , fsrc = id .normalizedSource (), toFold (id .normalizedSource ())
1412
+ if id .Source != "" {
1413
+ root = string (id .ProjectRoot )
1414
+ froot = toFold (root )
1415
+ } else {
1416
+ root , froot = src , fsrc
1417
+ }
1418
+
1391
1419
for k , ds := range sm .specs {
1392
1420
// Cheat for root, otherwise we blow up b/c version is empty
1393
1421
if fsrc == string (ds .n ) && (k == 0 || ds .v .Matches (v )) {
1394
1422
var replace bool
1395
- if src != string (ds .n ) {
1423
+ if root != string (ds .n ) {
1396
1424
// We're in a case-varying lookup; ensure we replace the actual
1397
1425
// leading ProjectRoot portion of import paths with the literal
1398
1426
// string from the input.
@@ -1405,7 +1433,7 @@ func (sm *bmSourceManager) ListPackages(id ProjectIdentifier, v Version) (pkgtre
1405
1433
}
1406
1434
for _ , pkg := range ds .pkgs {
1407
1435
if replace {
1408
- pkg .path = strings .Replace (pkg .path , fsrc , src , 1 )
1436
+ pkg .path = strings .Replace (pkg .path , froot , root , 1 )
1409
1437
}
1410
1438
ptree .Packages [pkg .path ] = pkgtree.PackageOrErr {
1411
1439
P : pkgtree.Package {
0 commit comments