File: file_46.f90

package info (click to toggle)
lfortran 0.60.0-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 58,416 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 38; javascript: 15
file content (25 lines) | stat: -rw-r--r-- 717 bytes parent folder | download
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
program file_46
    implicit none

    character(len=40), parameter :: help_text(2) = [character(len=40) :: &
        'NAME', 'DESCRIPTION']

    integer :: i, lun
    character(len=200) :: line
    integer :: expected_len
    integer :: filesize

    open(newunit=lun, file='out.txt', status='replace', action='write')
    write(lun,'(g0)') (trim(help_text(i)), i=1, size(help_text))

    expected_len = len('NAME'//new_line('a')//'DESCRIPTION'//new_line('a'))

    inquire(file='out.txt', size=filesize)
    if (filesize /= expected_len) then
        error stop 'EXTRA BYTES WRITTEN (LIKELY SPACES)'
    end if

    print *, 'PASSED: no trailing spaces written'
    close(lun, status='delete')

end program file_46