@@ -847,38 +847,56 @@ var bimodalFixtures = map[string]bimodalFixture{
847847 ),
848848 },
849849 "simple case-only variations plus source variance" : {
850- // COPYPASTA BELOW, FIX IT
851850 ds : []depspec {
852851 dsp (mkDepspec ("root 0.0.0" ),
853- pkg ("root" , "foo" , "Bar " )), // TODO align the froms
852+ pkg ("root" , "foo" , "bar " )),
854853 dsp (mkDepspec ("foo 1.0.0" , "Bar from quux 1.0.0" ),
855854 pkg ("foo" , "Bar" )),
856855 dsp (mkDepspec ("bar 1.0.0" ),
857856 pkg ("bar" )),
858857 dsp (mkDepspec ("quux 1.0.0" ),
859858 pkg ("bar" )),
860859 },
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+ },
865873 },
866874 "case-only variations plus source variance with internal canonicality" : {
867- // COPYPASTA BELOW, FIX IT
868875 ds : []depspec {
869- dsp (mkDepspec ("root 0.0.0" ),
876+ dsp (mkDepspec ("root 0.0.0" , "Bar from quux 1.0.0" ),
870877 pkg ("root" , "foo" , "Bar" )),
871878 dsp (mkDepspec ("foo 1.0.0" , "Bar from quux 1.0.0" ),
872879 pkg ("foo" , "Bar" )),
873880 dsp (mkDepspec ("bar 1.0.0" ),
874- pkg ("bar" )),
881+ pkg ("bar" , "bar/subpkg" ),
882+ pkg ("bar/subpkg" )),
875883 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+ },
877899 },
878- r : mksolution (
879- "foo 1.0.0" ,
880- "Bar from quux 1.0.0" ,
881- ),
882900 },
883901 "alternate net address" : {
884902 ds : []depspec {
@@ -1387,12 +1405,22 @@ func newbmSM(bmf bimodalFixture) *bmSourceManager {
13871405}
13881406
13891407func (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+
13911419 for k , ds := range sm .specs {
13921420 // Cheat for root, otherwise we blow up b/c version is empty
13931421 if fsrc == string (ds .n ) && (k == 0 || ds .v .Matches (v )) {
13941422 var replace bool
1395- if src != string (ds .n ) {
1423+ if root != string (ds .n ) {
13961424 // We're in a case-varying lookup; ensure we replace the actual
13971425 // leading ProjectRoot portion of import paths with the literal
13981426 // string from the input.
@@ -1405,7 +1433,7 @@ func (sm *bmSourceManager) ListPackages(id ProjectIdentifier, v Version) (pkgtre
14051433 }
14061434 for _ , pkg := range ds .pkgs {
14071435 if replace {
1408- pkg .path = strings .Replace (pkg .path , fsrc , src , 1 )
1436+ pkg .path = strings .Replace (pkg .path , froot , root , 1 )
14091437 }
14101438 ptree .Packages [pkg .path ] = pkgtree.PackageOrErr {
14111439 P : pkgtree.Package {
0 commit comments