Re: [PATCH v9 1/5] dir_iterator: add tests for dir_iterator API
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 18, 2017, 04:37 UTC
- Message-ID
- <xmqqzifee3fo.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1492462296-4990-2-git-send-email-bnmvco@gmail.com>
Daniel Ferreira <bnmvco@gmail.com> writes:
Show 20 quoted lines
> +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
EOFtest-dir-iterator ./dir >out && sort <out >./actual-pre-order-sorted-output &&
test_cmp expect-sorted-output actual-pre-order-sorted-output '