1 // Copyright © 2014 Steve Francia <spf@spf13.com>.
2 // Copyright 2009 The Go Authors. All rights reserved.
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
23 func TestWalk(t *testing.T) {
24 defer removeAllTestFiles(t)
26 for i, fs := range Fss {
28 testDir = setupTestDirRoot(t, fs)
30 setupTestDirReusePath(t, fs, testDir)
34 outputs := make([]string, len(Fss))
35 for i, fs := range Fss {
36 walkFn := func(path string, info os.FileInfo, err error) error {
38 t.Error("walkFn err:", err)
44 outputs[i] += fmt.Sprintln(path, info.Name(), size, info.IsDir(), err)
47 err := Walk(fs, testDir, walkFn)
53 for i, o := range outputs {
57 if o != outputs[i-1] {
63 t.Log("Walk outputs not equal!")
64 for i, o := range outputs {
65 t.Log(Fss[i].Name() + "\n" + o)