Style fixes.

This commit is contained in:
Andrey Smirnov
2014-02-25 14:25:14 +04:00
parent 70df28bdf4
commit e0cb43fbd3
3 changed files with 14 additions and 16 deletions

16
debian/deb_test.go vendored
View File

@@ -14,18 +14,18 @@ type DebSuite struct {
var _ = Suite(&DebSuite{})
func (s *DebSuite) SetUpSuite(c *C) {
_, __file__, _, _ := runtime.Caller(0)
s.debFile = filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
s.dscFile = filepath.Join(filepath.Dir(__file__), "../system/files/pyspi_0.6.1-1.3.dsc")
s.dscFileNoSign = filepath.Join(filepath.Dir(__file__), "../system/files/pyspi-0.6.1-1.3.stripped.dsc")
_, _File, _, _ := runtime.Caller(0)
s.debFile = filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
s.dscFile = filepath.Join(filepath.Dir(_File), "../system/files/pyspi_0.6.1-1.3.dsc")
s.dscFileNoSign = filepath.Join(filepath.Dir(_File), "../system/files/pyspi-0.6.1-1.3.stripped.dsc")
}
func (s *DebSuite) TestGetControlFileFromDeb(c *C) {
_, err := GetControlFileFromDeb("/no/such/file")
c.Check(err, ErrorMatches, ".*no such file or directory")
_, __file__, _, _ := runtime.Caller(0)
_, err = GetControlFileFromDeb(__file__)
_, _File, _, _ := runtime.Caller(0)
_, err = GetControlFileFromDeb(_File)
c.Check(err, ErrorMatches, "unable to read .deb archive: ar: missing global header")
st, err := GetControlFileFromDeb(s.debFile)
@@ -40,8 +40,8 @@ func (s *DebSuite) TestGetControlFileFromDsc(c *C) {
_, err := GetControlFileFromDsc("/no/such/file", verifier)
c.Check(err, ErrorMatches, ".*no such file or directory")
_, __file__, _, _ := runtime.Caller(0)
_, err = GetControlFileFromDsc(__file__, verifier)
_, _File, _, _ := runtime.Caller(0)
_, err = GetControlFileFromDsc(_File, verifier)
c.Check(err, ErrorMatches, "malformed stanza syntax")
st, err := GetControlFileFromDsc(s.dscFile, verifier)

6
debian/package.go vendored
View File

@@ -375,9 +375,8 @@ func (p *Package) Equals(p2 *Package) bool {
found = true
if f.Checksums != f2.Checksums {
return false
} else {
break
}
break
}
}
@@ -554,9 +553,8 @@ func (collection *PackageCollection) Update(p *Package) error {
found = true
if f.Checksums != f2.Checksums {
return fmt.Errorf("unable to save: %s, conflict with existing packge", p)
} else {
break
}
break
}
}

View File

@@ -87,8 +87,8 @@ func (s *PackagePoolSuite) TestRemove(c *C) {
}
func (s *PackagePoolSuite) TestImportOk(c *C) {
_, __file__, _, _ := runtime.Caller(0)
debFile := filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
_, _File, _, _ := runtime.Caller(0)
debFile := filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
err := s.pool.Import(debFile, "91b1a1480b90b9e269ca44d897b12575")
c.Check(err, IsNil)
@@ -108,8 +108,8 @@ func (s *PackagePoolSuite) TestImportNotExist(c *C) {
}
func (s *PackagePoolSuite) TestImportOverwrite(c *C) {
_, __file__, _, _ := runtime.Caller(0)
debFile := filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
_, _File, _, _ := runtime.Caller(0)
debFile := filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb")
os.MkdirAll(filepath.Join(s.pool.rootPath, "91", "b1"), 0755)
ioutil.WriteFile(filepath.Join(s.pool.rootPath, "91", "b1", "libboost-program-options-dev_1.49.0.1_i386.deb"), []byte("1"), 0644)