Merge pull request #183 from jawr/walker_path_fix

Rework walker.Next
This commit is contained in:
Julien Laffaye
2020-07-28 14:05:16 -04:00
committed by GitHub
2 changed files with 38 additions and 26 deletions

View File

@@ -184,3 +184,26 @@ func TestCurAndStackSetCorrectly(t *testing.T) {
assert.Equal(0, len(w.stack))
assert.Equal("file", w.cur.entry.Name)
}
func TestCurInit(t *testing.T) {
mock, err := newFtpMock(t, "127.0.0.1")
if err != nil {
t.Fatal(err)
}
defer mock.Close()
c, cErr := Connect(mock.Addr())
if cErr != nil {
t.Fatal(err)
}
w := c.Walk("/root")
result := w.Next()
// mock fs has one file 'lo'
assert.Equal(t, true, result, "Result should return false")
assert.Equal(t, 0, len(w.stack))
assert.Equal(t, "/root/lo", w.Path())
}