File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ type PinDepend struct {
3939// Returns dep.
4040func (dep * PinDepend ) Normalize () * PinDepend {
4141 dep .Package = strings .TrimSuffix (dep .Package , ".dev" )
42- if strings .HasPrefix ("https://" , dep . URL ) {
42+ if strings .HasPrefix (dep . URL , "https://" ) {
4343 dep .URL = "git+" + dep .URL
4444 }
4545 return dep
Original file line number Diff line number Diff line change @@ -177,13 +177,23 @@ func TestAddPinDepend_Update(t *testing.T) {
177177 assert .True (t , found , "perennial not found after update" )
178178}
179179
180+ func TestNormalize (t * testing.T ) {
181+ dep := PinDepend {
182+ Package : "new-package" ,
183+ URL : "https://example.com/package" ,
184+ Commit : "abc123" ,
185+ }
186+ dep .Normalize ()
187+ assert .Equal (t , "git+https://example.com/package" , dep .URL )
188+ }
189+
180190func TestAddPinDepend_Add (t * testing.T ) {
181191 f := parseString (t , exampleOpam )
182192
183193 // Add new dependency
184194 f .AddPinDepend (PinDepend {
185195 Package : "new-package" ,
186- URL : "git+ https://example.com/package" ,
196+ URL : "https://example.com/package" ,
187197 Commit : "abc123" ,
188198 })
189199
You can’t perform that action at this time.
0 commit comments