2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Sanity check for the automake testsuite.
18 # Check the 'unindent' subroutine.
24 #------------------------------------------------------------------
26 will_test () { tst=$*; }
30 command_ok_ "$tst [simple, exit status]" \
31 eval 'unindent input > got'
32 command_ok_ "$tst [simple, output]" \
34 command_ok_ "$tst [parallel, exit status]" \
35 eval 'unindent input | unindent > got'
36 command_ok_ "$tst [parallel, output]" \
40 #------------------------------------------------------------------
42 will_test 'leading spaces'
59 14 this${tab}with${tab}multiple fields${sp}
60 15 and ${tab}${tab}this too${tab}
84 14 this${tab}with${tab}multiple fields${sp}
85 15 and ${tab}${tab}this too${tab}
96 #------------------------------------------------------------------
98 will_test 'leading tab'
114 ${tab}14 this with${tab}multiple fields${sp}
115 15 and ${tab}${tab}this too${tab}
138 14 this with${tab}multiple fields${sp}
139 15 and ${tab}${tab}this too${tab}
148 do_check "leading tab"
150 #------------------------------------------------------------------
152 will_test 'no leading whitespace'
166 14 this with${tab}multiple fields${sp}
167 15 and this too${tab}
168 ${tab}16 and also this
179 #------------------------------------------------------------------
181 will_test 'leading empty lines ignored (1)'
201 #------------------------------------------------------------------
203 will_test 'leading empty lines ignored (2)'
223 #------------------------------------------------------------------
225 will_test 'more elaborated parallel use'
250 command_ok_ "$tst [exit status]" \
251 eval 'unindent input | sed 1d | unindent > got'
253 command_ok_ "$tst [output]" diff exp got