Message ID | 20200925170256.11490-10-shubhunic@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Modernizing the t7001 test script | expand |
shubham verma <shubhunic@gmail.com> writes: > From: Shubham Verma <shubhunic@gmail.com> > > Change from old style to current style by taking advantage of > here-docs instead of echo commands. > > Signed-off-by: shubham verma <shubhunic@gmail.com> > --- > t/t7001-mv.sh | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh > index 94c5b10f8a..30714a8200 100755 > --- a/t/t7001-mv.sh > +++ b/t/t7001-mv.sh > @@ -222,7 +222,10 @@ test_expect_success 'git mv to move multiple sources into a directory' ' > git add dir/?.txt && > git mv dir/a.txt dir/b.txt other && > git ls-files >actual && > - { echo other/a.txt; echo other/b.txt; } >expect && > + cat >expect <<-\EOF && > + other/a.txt > + other/b.txt > + EOF This could be written with test_write_lines but a here-doc would be a better option in this case, as we will see the expected output from the tested command in the exact form.
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 94c5b10f8a..30714a8200 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -222,7 +222,10 @@ test_expect_success 'git mv to move multiple sources into a directory' ' git add dir/?.txt && git mv dir/a.txt dir/b.txt other && git ls-files >actual && - { echo other/a.txt; echo other/b.txt; } >expect && + cat >expect <<-\EOF && + other/a.txt + other/b.txt + EOF test_cmp expect actual '