Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a711f16

Browse files
committedAug 12, 2017
Make it more clear when a conversion error was unexpected or missing
1 parent ead19b8 commit a711f16

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
 

‎cmd/dep/glide_importer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func TestGlideConfig_Convert(t *testing.T) {
174174
manifest, lock, convertErr := g.convert(testCase.projectRoot)
175175
err := validateConvertTestCase(testCase.convertTestCase, manifest, lock, convertErr)
176176
if err != nil {
177-
t.Fatalf("%+v", err)
177+
t.Fatalf("%#v", err)
178178
}
179179
})
180180
}

‎cmd/dep/godep_importer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func TestGodepConfig_Convert(t *testing.T) {
141141
manifest, lock, convertErr := g.convert(testCase.projectRoot)
142142
err := validateConvertTestCase(testCase.convertTestCase, manifest, lock, convertErr)
143143
if err != nil {
144-
t.Fatalf("%+v", err)
144+
t.Fatalf("%#v", err)
145145
}
146146
})
147147
}

‎cmd/dep/root_analyzer_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,17 @@ type convertTestCase struct {
171171
// validateConvertTestCase returns an error if any of the importer's
172172
// conversion validations failed.
173173
func validateConvertTestCase(testCase *convertTestCase, manifest *dep.Manifest, lock *dep.Lock, convertErr error) error {
174-
if convertErr != nil {
175-
if testCase.wantConvertErr {
176-
return nil
174+
if testCase.wantConvertErr {
175+
if convertErr == nil {
176+
return errors.New("Expected the conversion to fail, but it did not return an error")
177177
}
178+
return nil
179+
}
178180

179-
return convertErr
181+
if convertErr != nil {
182+
return errors.Wrap(convertErr, "Expected the conversion to pass, but it returned an error")
180183
}
181-
184+
182185
// Ignored projects checks.
183186
if len(manifest.Ignored) != testCase.wantIgnoreCount {
184187
return errors.Errorf("Expected manifest to have %d ignored project(s), got %d",

0 commit comments

Comments
 (0)
This repository has been archived.