Daniel Ferreira <bnm...@gmail.com> writes:

> +cat >expect-sorted-output <<-\EOF &&
> +[d] (a) [a] ./dir/a
> +[d] (a/b) [b] ./dir/a/b
> +[d] (a/b/c) [c] ./dir/a/b/c
> +[d] (d) [d] ./dir/d
> +[d] (d/e) [e] ./dir/d/e
> +[d] (d/e/d) [d] ./dir/d/e/d
> +[f] (a/b/c/d) [d] ./dir/a/b/c/d
> +[f] (a/e) [e] ./dir/a/e
> +[f] (b) [b] ./dir/b
> +[f] (c) [c] ./dir/c
> +[f] (d/e/d/a) [a] ./dir/d/e/d/a
> +EOF
> +
> +test_expect_success 'dir-iterator should iterate through all files' '
> +     test-dir-iterator ./dir >out &&
> +     sort <out >./actual-pre-order-sorted-output &&
> +
> +     test_cmp expect-sorted-output actual-pre-order-sorted-output
> +'

Modern tests create these test vectors inside test_expect_success
block, like so:

test_expect_success 'dir-iterator should iterate through all files' '
        cat >expect-sorted-output <<-\EOF &&
        [d] (a) [a] ./dir/a
        [d] (a/b) [b] ./dir/a/b
        [d] (a/b/c) [c] ./dir/a/b/c
        [d] (d) [d] ./dir/d
        [d] (d/e) [e] ./dir/d/e
        [d] (d/e/d) [d] ./dir/d/e/d
        [f] (a/b/c/d) [d] ./dir/a/b/c/d
        [f] (a/e) [e] ./dir/a/e
        [f] (b) [b] ./dir/b
        [f] (c) [c] ./dir/c
        [f] (d/e/d/a) [a] ./dir/d/e/d/a
        EOF

        test-dir-iterator ./dir >out &&
        sort <out >./actual-pre-order-sorted-output &&

        test_cmp expect-sorted-output actual-pre-order-sorted-output
'

Reply via email to