diff mbox series

[v2,08/15] t0066: reorder tests from simple to more complex

Message ID 20220509175159.2948802-9-kioplato@gmail.com (mailing list archive)
State New, archived
Headers show
Series iterate dirs before or after their contents | expand

Commit Message

Plato Kiorpelidis May 9, 2022, 5:51 p.m. UTC
Gradually increase the complexity of the tests. This reordering helps
when testing dir-iterator, explicitly or by running the full test suite.
In case a test fails it provides additional aid searching for and finding
the part of dir-iterator that causes the test to fail, making it easier.

Signed-off-by: Plato Kiorpelidis <kioplato@gmail.com>
---
 t/t0066-dir-iterator.sh | 62 ++++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 31 deletions(-)
diff mbox series

Patch

diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh
index 932b1f291c..9b3ce99382 100755
--- a/t/t0066-dir-iterator.sh
+++ b/t/t0066-dir-iterator.sh
@@ -96,37 +96,6 @@  test_expect_success 'iteration of dir w/ dir w/ a file' '
 	test_cmp expected-out actual-out
 '
 
-test_expect_success 'setup -- dir w/ complex structure' '
-	mkdir -p dir &&
-	mkdir -p dir/a/b/c/ &&
-	>dir/b &&
-	>dir/c &&
-	mkdir -p dir/d/e/d/ &&
-	>dir/a/b/c/d &&
-	>dir/a/e &&
-	>dir/d/e/d/a
-'
-test_expect_success 'dir-iterator should iterate through all files' '
-	cat >expected-sorted-out <<-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-tool dir-iterator ./dir >actual-out &&
-	sort actual-out >actual-sorted-out &&
-
-	test_cmp expected-sorted-out actual-sorted-out
-'
-
 test_expect_success 'setup -- dir w/ three nested dirs w/ file' '
 	mkdir -p dir2/a/b/c &&
 	>dir2/a/b/c/d
@@ -283,6 +252,37 @@  test_expect_success 'iteration of dir w/ two nested dirs, each w/ file' '
 	)
 '
 
+test_expect_success 'setup -- dir w/ complex structure' '
+	mkdir -p dir &&
+	mkdir -p dir/a/b/c/ &&
+	>dir/b &&
+	>dir/c &&
+	mkdir -p dir/d/e/d/ &&
+	>dir/a/b/c/d &&
+	>dir/a/e &&
+	>dir/d/e/d/a
+'
+test_expect_success 'dir-iterator should iterate through all files' '
+	cat >expected-sorted-out <<-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-tool dir-iterator ./dir >actual-out &&
+	sort actual-out >actual-sorted-out &&
+
+	test_cmp expected-sorted-out actual-sorted-out
+'
+
 test_expect_success POSIXPERM,SANITY 'setup -- dir w/o perms' '
 	mkdir -p dir12/a &&
 	>dir12/a/b