3 test_description
='Test the dir-iterator functionality'
7 test_expect_success
'setup' '
12 mkdir -p dir/d/e/d/ &&
17 mkdir -p dir2/a/b/c/ &&
21 test_expect_success
'dir-iterator should iterate through all files' '
22 cat >expected-iteration-sorted-output <<-EOF &&
24 [d] (a/b) [b] ./dir/a/b
25 [d] (a/b/c) [c] ./dir/a/b/c
27 [d] (d/e) [e] ./dir/d/e
28 [d] (d/e/d) [d] ./dir/d/e/d
29 [f] (a/b/c/d) [d] ./dir/a/b/c/d
30 [f] (a/e) [e] ./dir/a/e
33 [f] (d/e/d/a) [a] ./dir/d/e/d/a
36 test-tool dir-iterator ./dir >out &&
37 sort out >./actual-iteration-sorted-output &&
39 test_cmp expected-iteration-sorted-output actual-iteration-sorted-output
42 test_expect_success
'dir-iterator should list files in the correct order' '
43 cat >expected-pre-order-output <<-EOF &&
45 [d] (a/b) [b] ./dir2/a/b
46 [d] (a/b/c) [c] ./dir2/a/b/c
47 [f] (a/b/c/d) [d] ./dir2/a/b/c/d
50 test-tool dir-iterator ./dir2 >actual-pre-order-output &&
52 test_cmp expected-pre-order-output actual-pre-order-output