From: Junio C Hamano Date: Tue, 18 Apr 2017 04:37:47 GMT Subject: Re: [PATCH v9 1/5] dir_iterator: add tests for dir_iterator API Message-ID: In-Reply-To: <1492462296-4990-2-git-send-email-bnmvco@gmail.com> Daniel Ferreira 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 ./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 ./actual-pre-order-sorted-output && test_cmp expect-sorted-output actual-pre-order-sorted-output '