(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git stripspace'>)} spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:t40) op: assign_op.Equal rhs: {(SQ <'A quick brown fox jumps over the lazy do'>)} spids: [24] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:s40) op: assign_op.Equal rhs: {(SQ <' '>)} spids: [29] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sss) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ($ Id.VSub_DollarName '$s40') ) } spids: [34] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ttt) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ($ Id.VSub_DollarName '$t40') ) } spids: [51] ) ] ) (C {<test_expect_success>} {(SQ <'long lines without spaces should be unchanged'>)} { (SQ <'\n'> <' echo "$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt$ttt$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'lines with spaces at the beginning should be unchanged'>)} { (SQ <'\n'> <' echo "$sss$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss$sss$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss$sss$sss$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'lines with intermediate spaces should be unchanged'>)} { (SQ <'\n'> <' echo "$ttt$sss$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$sss$sss$ttt" >expect &&\n'> <' git stripspace <expect >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'consecutive blank lines should be unified'>)} { (SQ <'\n'> <' printf "$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt\\n\\n\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt$ttt\\n\\n\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n\\n\\n\\n$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n\\n\\n\\n$ttt$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt\\n\\n$ttt\\n" > expect &&\n'> < ' printf "$ttt$ttt$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt\\n" | git stripspace >actual &&\n' > <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$ttt$ttt$ttt\\n" > expect &&\n'> < ' printf "$ttt\\n\\t\\n \\n\\n \\t\\t\\n$ttt$ttt$ttt\\n" | git stripspace >actual &&\n' > <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'only consecutive blank lines should be completely removed'>)} { (SQ <'\n'> <' > expect &&\n'> <'\n'> <' printf "\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss\\n$sss\\n$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss\\n$sss\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n$sss\\n$sss$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss$sss$sss\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n$sss$sss$sss$sss\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n\\n$sss$sss$sss$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'consecutive blank lines at the beginning should be removed'>)} { (SQ <'\n'> <' printf "$ttt\\n" > expect &&\n'> <' printf "\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" > expect &&\n'> <' printf "\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n" > expect &&\n'> <' printf "\\n\\n\\n$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt\\n" > expect &&\n'> <' printf "\\n\\n\\n$ttt$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt$ttt\\n" > expect &&\n'> <' printf "\\n\\n\\n$ttt$ttt$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" > expect &&\n'> <'\n'> <' printf "$sss\\n$sss\\n$sss\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n$sss\\n$sss$sss\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss\\n$sss\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss$sss\\n\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n$sss$sss$sss\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "\\n\\n$sss$sss$sss\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'consecutive blank lines at the end should be removed'>)} { (SQ <'\n'> <' printf "$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" > expect &&\n'> <' printf "$ttt\\n\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt\\n\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt$ttt\\n\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt$ttt\\n" > expect &&\n'> <' printf "$ttt$ttt$ttt$ttt\\n\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" > expect &&\n'> <'\n'> <' printf "$ttt\\n$sss\\n$sss\\n$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$sss\\n$sss$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$sss$sss\\n$sss\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$sss$sss$sss\\n\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n$sss$sss$sss\\n\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n\\n\\n$sss$sss$sss\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'text without newline at end should end with newline'>)} { (SQ <'\n'> <' test $(printf "$ttt" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l) -gt 0\n'> ) } ) (C {<test_expect_success>} {(SQ <'text plus spaces without newline at end should end with newline'>)} { (SQ <'\n'> <' test $(printf "$ttt$sss" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$ttt$sss$sss" | git stripspace | wc -l) -gt 0 &&\n'> <' test $(printf "$ttt$sss$sss$sss" | git stripspace | wc -l) -gt 0\n'> ) } ) (C {<test_expect_success>} {(SQ <'text plus spaces without newline at end should not show spaces'>)} { (SQ <'\n'> <' ! (printf "$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)\n'> ) } ) (C {<test_expect_success>} {(SQ <'text plus spaces without newline should show the correct lines'>)} { (SQ <'\n'> <' printf "$ttt\\n" >expect &&\n'> <' printf "$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" >expect &&\n'> <' printf "$ttt$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n" >expect &&\n'> <' printf "$ttt$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n" >expect &&\n'> <' printf "$ttt$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n" >expect &&\n'> <' printf "$ttt$ttt$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt$ttt\\n" >expect &&\n'> <' printf "$ttt$ttt$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'text plus spaces at end should not show spaces'>)} { (SQ <'\n'> <' ! (echo "$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (echo "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (echo "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (echo "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)\n'> ) } ) (C {<test_expect_success>} {(SQ <'text plus spaces at end should be cleaned and newline must remain'>)} { (SQ <'\n'> <' echo "$ttt" >expect &&\n'> <' echo "$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt" >expect &&\n'> <' echo "$ttt$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt" >expect &&\n'> <' echo "$ttt$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt" >expect &&\n'> <' echo "$ttt$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt" >expect &&\n'> <' echo "$ttt$ttt$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$ttt$ttt$ttt" >expect &&\n'> <' echo "$ttt$ttt$ttt$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'spaces with newline at end should be replaced with empty string'>)} { (SQ <'\n'> <' printf "" >expect &&\n'> <'\n'> <' echo | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' echo "$sss$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'spaces without newline at end should not show spaces'>)} { (SQ <'\n'> <' ! (printf "" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) &&\n'> <' ! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null)\n'> ) } ) (C {<test_expect_success>} {(SQ <'spaces without newline at end should be replaced with empty string'>)} { (SQ <'\n'> <' printf "" >expect &&\n'> <'\n'> <' printf "" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$sss$sss$sss$sss" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'consecutive text lines should be unchanged'>)} { (SQ <'\n'> <' printf "$ttt$ttt\\n$ttt\\n" >expect &&\n'> <' printf "$ttt$ttt\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$ttt$ttt\\n$ttt\\n" >expect &&\n'> <' printf "$ttt\\n$ttt$ttt\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$ttt\\n$ttt\\n$ttt$ttt\\n" >expect &&\n'> <' printf "$ttt\\n$ttt\\n$ttt\\n$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$ttt\\n\\n$ttt$ttt\\n$ttt\\n" >expect &&\n'> <' printf "$ttt\\n$ttt\\n\\n$ttt$ttt\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt$ttt\\n\\n$ttt\\n$ttt$ttt\\n" >expect &&\n'> <' printf "$ttt$ttt\\n\\n$ttt\\n$ttt$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual &&\n'> <'\n'> <' printf "$ttt\\n$ttt$ttt\\n\\n$ttt\\n" >expect &&\n'> <' printf "$ttt\\n$ttt$ttt\\n\\n$ttt\\n" | git stripspace >actual &&\n'> <' test_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'strip comments, too'>)} { (SQ <'\n'> <'\ttest ! -z "$(echo "# comment" | git stripspace)" &&\n'> <'\ttest -z "$(echo "# comment" | git stripspace -s)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'strip comments with changed comment char'>)} { (SQ <'\n'> <'\ttest ! -z "$(echo "; comment" | git -c core.commentchar=";" stripspace)" &&\n'> <'\ttest -z "$(echo "; comment" | git -c core.commentchar=";" stripspace -s)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'-c with single line'>)} { (SQ <'\n'> <'\tprintf "# foo\\n" >expect &&\n'> <'\tprintf "foo" | git stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'-c with single line followed by empty line'>)} { (SQ <'\n'> <'\tprintf "# foo\\n#\\n" >expect &&\n'> <'\tprintf "foo\\n\\n" | git stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'-c with newline only'>)} { (SQ <'\n'> <'\tprintf "#\\n" >expect &&\n'> <'\tprintf "\\n" | git stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--comment-lines with single line'>)} { (SQ <'\n'> <'\tprintf "# foo\\n" >expect &&\n'> <'\tprintf "foo" | git stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'-c with changed comment char'>)} { (SQ <'\n'> <'\tprintf "; foo\\n" >expect &&\n'> <'\tprintf "foo" | git -c core.commentchar=";" stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'avoid SP-HT sequence in commented line'>)} { (SQ <'\n'> <'\tprintf "#\\tone\\n#\\n# two\\n" >expect &&\n'> <'\tprintf "\\tone\\n\\ntwo\\n" | git stripspace -c >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )