[go: up one dir, main page]

File: test16.sh

package info (click to toggle)
findent 4.3.5-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 2,972 kB
  • sloc: sh: 9,350; cpp: 6,224; fortran: 2,901; lex: 690; yacc: 515; makefile: 224; python: 155; lisp: 52
file content (531 lines) | stat: -rwxr-xr-x 8,707 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
#!/bin/sh
# -copyright-
#-# Copyright: 2015-2025 Willem Vermin wvermin@gmail.com
#-# 
#-# License: BSD-3-Clause
#-#  Redistribution and use in source and binary forms, with or without
#-#  modification, are permitted provided that the following conditions
#-#  are met:
#-#  1. Redistributions of source code must retain the above copyright
#-#     notice, this list of conditions and the following disclaimer.
#-#  2. Redistributions in binary form must reproduce the above copyright
#-#     notice, this list of conditions and the following disclaimer in the
#-#     documentation and/or other materials provided with the distribution.
#-#  3. Neither the name of the copyright holder nor the names of its
#-#     contributors may be used to endorse or promote products derived
#-#     from this software without specific prior written permission.
#-#   
#-#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#-#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#-#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#-#  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE HOLDERS OR
#-#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
#-#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#-#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
#-#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#-#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
#-#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#-#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

if test -e prelude ; then
   . ./prelude
else
   . ./debian/tests/prelude
fi
rc=0
doit=../doit
cat << eof > prog
      program main01
      continue
      end
eof
cat << eof > expect
           program main01
              continue
           end
eof

$doit "-I5 --start_indent=5" -i3 "for fixed input"
rc=`expr $rc + $?`

cat << eof > prog
      program main02
 continue
      end
eof
cat << eof > expect
     program main02
        continue
     end
eof
$doit "-I5 --start_indent=5" -i3 "for free input"
rc=`expr $rc + $?`

cat << eof > prog
        program main03
      continue
      end
eof
cat << eof > expect
        program main03
           continue
        end
eof
$doit "-Ia --start_indent=a" "-I0 -i3" ""
rc=`expr $rc + $?`

cat << eof > prog
 program main04
continue
do i=1,10
do j=1,20
   continue
enddo
enddo
end
eof

cat << eof > expect
program main04
     continue
     do i=1,10
          do j=1,20
               continue
          enddo
     enddo
end
eof
$doit "-i5 --indent=5" "-I0" ""
rc=`expr $rc + $?`


cat << eof > prog
      program main06
associate( z => sin(theta))
print *,z
end associate
      end
eof

cat << eof > expect
program main06
   associate( z => sin(theta))
        print *,z
   end associate
end
eof

$doit "-a5 --indent_associate=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main07
block
continue
end block
end
eof
cat << eof > expect
program main07
   block
        continue
   end block
end
eof

$doit "-b5 --indent_block=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
        program main08
do i=1,10
do j=1,5
   print *,i,j
enddo
enddo
         end
eof

cat << eof > expect
program main08
   do i=1,10
        do j=1,5
             print *,i,j
        enddo
   enddo
end
eof

$doit "-d5 --indent_do=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
  program main09
if (i .eq. 7) then
   print *,'foo'
   continue
endif

         continue
         end
eof

cat << eof > expect
program main09
   if (i .eq. 7) then
        print *,'foo'
        continue
   endif

   continue
end
eof

$doit "-f5 --indent_if=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
  program main10
enum, bind(c)
enumerator :: red = 1, blue black = 5
enumerator yellow
end enum
         end
eof

cat << eof > expect
program main10
   enum, bind(c)
        enumerator :: red = 1, blue black = 5
        enumerator yellow
   end enum
end
eof

$doit "-E5 --indent_enum=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
   program main11
forall(k=1:1000)
x(k) = 23
y(k) = 67
end forall
end
eof

cat << eof > expect
program main11
   forall(k=1:1000)
        x(k) = 23
        y(k) = 67
   end forall
end
eof

$doit "-F5 --indent_forall=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main12
interface myinterface
subroutine mysub(x)
real x
end subroutine
end interface
end
eof

cat << eof > expect
program main12
   interface myinterface
        subroutine mysub(x)
           real x
        end subroutine
   end interface
end
eof

$doit "-j5 --indent_interface=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
   module mymodule01
integer x
contains
subroutine mysub
continue
end subroutine
end module
eof

cat << eof > expect
module mymodule01
     integer x
  contains
     subroutine mysub
        continue
     end subroutine
end module
eof

$doit "-m5 --indent_module=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
   subroutine mysub01
continue
end subroutine
function myfun(x)
real x
end function
eof

cat << eof > expect
subroutine mysub01
     continue
end subroutine
function myfun(x)
     real x
end function
eof

$doit "-r5 --indent_procedure=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main13
      continue
select case(i)
   case(1)
      x=2
      case(3)
         x=4
      end select
      continue
   end program
eof

cat << eof > expect
program main13
   continue
   select case(i)
      case(1)
        x=2
      case(3)
        x=4
   end select
   continue
end program
eof
$doit "-s5 --indent_select=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main14
type mytype
integer :: i
real x,y
end type mytype
end program
eof
cat << eof > expect
program main14
   type mytype
        integer :: i
        real x,y
   end type mytype
end program
eof
$doit "-t5 --indent_type=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main15
where(x>21)
y=10
z=11
end where
end program
eof
cat << eof > expect
program main15
   where(x>21)
        y=10
        z=11
   end where
end program
eof
$doit "-w5 --indent_where=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main16
continue
critical
x=10
y=11
end critical
end program
eof
cat << eof > expect
program main16
   continue
   critical
        x=10
        y=11
   end critical
end program
eof
$doit "-x5 --indent_critical=5" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main17
continue
contains
subroutine mysub
continue
end subroutine mysub
end program
eof
cat << eof > expect
program main17
   continue
contains
subroutine mysub
   continue
end subroutine mysub
end program
eof
$doit "-C- --indent_contains=restart" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main18
continue
x = x + &
& 10
y = y + &
5
end program
eof
cat << eof > expect
program main18
   continue
   x = x + &
   & 10
   y = y + &
5
end program
eof
$doit "-k- --indent_continuation=none" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main19
continue
select case(i)
   case(3)
      x=8
      case(5)
         y=2
      end select
      continue
end program
eof
cat << eof > expect
program main19
      continue
      select case(i)
        case(3)
            x=8
        case(5)
            y=2
      end select
      continue
end program
eof
$doit "-c4 --indent_case=4" "-i6 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
program main20
continue
contains
function foo(bar)
real bar
continue
end function
end program
eof
cat << eof > expect
program main20
      continue
  contains
      function foo(bar)
            real bar
            continue
      end function
end program
eof
$doit "-C4 --indent_contains=4" "-i6 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
subroutine mysub02
continue
entry myentry
continue
end subroutine
eof
cat << eof > expect
subroutine mysub02
      continue
  entry myentry
      continue
end subroutine
eof
$doit "-e4 --indent_entry=4" "-i6 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
subroutine mysub03
do i=1,20
continue
!$ continue
enddo
end subroutine
eof
cat << eof > expect
subroutine mysub03
   do i=1,20
      continue
!$ continue
   enddo
end subroutine
eof
$doit "--openmp=0" "-i3 -I0" ""
rc=`expr $rc + $?`

cat << eof > prog
         subroutine mysub04
         do i=1,20
               continue
!$       continue
            enddo
            end subroutine
eof
cat << eof > expect
      subroutine mysub04
         do i=1,20
            continue
!$       continue
         enddo
      end subroutine
eof
$doit "--openmp=0" "-i3 -I0" ""
rc=`expr $rc + $?`

. ../postlude
exit $rc