Skip to content

Commit

Permalink
Adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LandonTClipp committed Jul 17, 2020
1 parent d18b044 commit cd0e2cc
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,39 @@ func (p *PathSuite) TestRenamePath() {
assert.False(p.T(), oldFileExists)
}

func (p *PathSuite) TestSizeZero() {
file := p.tmpdir.Join("file.txt")
require.NoError(p.T(), file.WriteFile([]byte{}, 0o644))
size, err := file.Size()
require.NoError(p.T(), err)
p.Zero(size)
}

func (p *PathSuite) TestSizeNonZero() {
msg := "oh, it's you"
file := p.tmpdir.Join("file.txt")
require.NoError(p.T(), file.WriteFile([]byte(msg), 0o644))
size, err := file.Size()
require.NoError(p.T(), err)
p.Equal(len(msg), int(size))
}

func (p *PathSuite) TestIsDir() {
dir := p.tmpdir.Join("dir")
require.NoError(p.T(), dir.Mkdir(0o755))
isDir, err := dir.IsDir()
require.NoError(p.T(), err)
p.True(isDir)
}

func (p *PathSuite) TestIsntDir() {
file := p.tmpdir.Join("file.txt")
require.NoError(p.T(), file.WriteFile([]byte("hello world!"), 0o644))
isDir, err := file.IsDir()
require.NoError(p.T(), err)
p.False(isDir)
}

func (p *PathSuite) TestGetLatest() {
now := time.Now()
for i := 0; i < 5; i++ {
Expand Down

0 comments on commit cd0e2cc

Please sign in to comment.