mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Test copyfile
This commit is contained in:
29
utils/copyfile_test.go
Normal file
29
utils/copyfile_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
type CopyfileSuite struct {
|
||||
source *os.File
|
||||
dest string
|
||||
}
|
||||
|
||||
var _ = Suite(&CopyfileSuite{})
|
||||
|
||||
func (s *CopyfileSuite) SetUpSuite(c *C) {
|
||||
s.source, _ = ioutil.TempFile(c.MkDir(), "source-file")
|
||||
s.dest = filepath.Join(filepath.Dir(s.source.Name()), "destination-file")
|
||||
}
|
||||
|
||||
func (s *CopyfileSuite) TestCopyFile(c *C) {
|
||||
err := CopyFile(s.source.Name(), s.dest)
|
||||
c.Check(err, Equals, nil)
|
||||
|
||||
_, err = os.Stat(s.dest)
|
||||
c.Check(err, Equals, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user