Thread (1 message) 1 message, 1 author, 2017-04-18

Re: [PATCH v9 1/5] dir_iterator: add tests for dir_iterator API

From: Junio C Hamano <hidden>
Date: 2017-04-18 04:37:57

Daniel Ferreira [off-list ref] 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
'
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help