patch-id: fix antipatterns in tests
Clean up the tests for patch-id by moving file preparation tasks inside the test body and redirecting files directly into stdin instead of using 'cat'. Signed-off-by: Jerry Zhang <jerry@skydio.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4c53a8c20f
commit
56fa5ac39a
@ -166,7 +166,8 @@ test_expect_success 'patch-id respects config from subdir' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
cat >nonl <<\EOF
|
test_expect_success 'patch-id handles no-nl-at-eof markers' '
|
||||||
|
cat >nonl <<-\EOF &&
|
||||||
diff --git i/a w/a
|
diff --git i/a w/a
|
||||||
index e69de29..2e65efe 100644
|
index e69de29..2e65efe 100644
|
||||||
--- i/a
|
--- i/a
|
||||||
@ -181,8 +182,7 @@ index e69de29..6178079 100644
|
|||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+b
|
+b
|
||||||
EOF
|
EOF
|
||||||
|
cat >withnl <<-\EOF &&
|
||||||
cat >withnl <<\EOF
|
|
||||||
diff --git i/a w/a
|
diff --git i/a w/a
|
||||||
index e69de29..7898192 100644
|
index e69de29..7898192 100644
|
||||||
--- i/a
|
--- i/a
|
||||||
@ -196,10 +196,8 @@ index e69de29..6178079 100644
|
|||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+b
|
+b
|
||||||
EOF
|
EOF
|
||||||
|
calc_patch_id nonl <nonl &&
|
||||||
test_expect_success 'patch-id handles no-nl-at-eof markers' '
|
calc_patch_id withnl <withnl &&
|
||||||
cat nonl | calc_patch_id nonl &&
|
|
||||||
cat withnl | calc_patch_id withnl &&
|
|
||||||
test_cmp patch-id_nonl patch-id_withnl
|
test_cmp patch-id_nonl patch-id_withnl
|
||||||
'
|
'
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user