1
1
program help_test
2
2
use ,intrinsic :: iso_fortran_env, only : stdin= >input_unit, stdout= >output_unit, stderr= >error_unit
3
3
implicit none
4
- integer :: i, j
4
+ integer :: i
5
5
integer :: be, af
6
6
character (len= :),allocatable :: path
7
7
integer :: estat, cstat
8
8
character (len= 256 ) :: message
9
9
logical ,allocatable :: tally(:)
10
- character (len= 1 ),allocatable :: book1(:), book2(:)
10
+ character (len= : ),allocatable :: book1(:), book2(:)
11
11
! intel_bug!character(len=:),allocatable :: page1(:)
12
- character (len= 132 ),allocatable :: page1(:)
12
+ character (len= : ),allocatable :: page1(:)
13
13
integer :: lines
14
14
integer :: chars
15
15
! run a variety of "fpm help" variations and verify expected files are generated
@@ -55,21 +55,17 @@ program help_test
55
55
endif
56
56
! !write(*,*)findloc(page1,'NAME').eq.1
57
57
be= count (.not. tally)
58
- ! !mingw bug this returns 0
59
- ! !tally=[tally,count(page1.eq.'NAME').eq.1]
60
- ! !tally=[tally,count(page1.eq.'SYNOPSIS').eq.1]
61
- ! !tally=[tally,count(page1.eq.'DESCRIPTION').eq.1]
62
- tally= [tally,bugcount(page1,' NAME' ).eq. 1 ]
63
- tally= [tally,bugcount(page1,' SYNOPSIS' ).eq. 1 ]
64
- tally= [tally,bugcount(page1,' DESCRIPTION' ).eq. 1 ]
58
+ tally= [tally,count (page1.eq. ' NAME' ).eq. 1 ]
59
+ tally= [tally,count (page1.eq. ' SYNOPSIS' ).eq. 1 ]
60
+ tally= [tally,count (page1.eq. ' DESCRIPTION' ).eq. 1 ]
65
61
af= count (.not. tally)
66
62
if (be.ne. af)then
67
63
write (* ,* )' <ERROR>missing expected sections in ' ,names(i)
68
64
write (* ,* )page1(1 ) ! assuming at least size 1 for debugging mingw
69
65
write (* ,* )count (page1.eq. ' NAME' )
70
66
write (* ,* )count (page1.eq. ' SYNOPSIS' )
71
67
write (* ,* )count (page1.eq. ' DESCRIPTION' )
72
- write (* ,' (a)' )( trim ( page1(j)),j = 1 , size (page1))
68
+ write (* ,' (a)' )page1
73
69
endif
74
70
write (* ,* )' <INFO>have completed ' ,count (tally),' tests'
75
71
call wipe(' fpm_scratch_help.txt' )
@@ -87,26 +83,31 @@ program help_test
87
83
enddo
88
84
89
85
! compare book written in fragments with manual
90
- call slurp(' fpm_scratch_help.txt' ,book1)
91
- call slurp(' fpm_scratch_manual.txt' ,book2)
86
+ call swallow(' fpm_scratch_help.txt' ,book1)
87
+ call swallow(' fpm_scratch_manual.txt' ,book2)
88
+ ! get rid of lines from run() which is not on stderr at the moment
89
+ book1= pack (book1,index (book1,' + build/' ).eq. 0 )
90
+ book2= pack (book1,index (book2,' + build/' ).eq. 0 )
92
91
write (* ,* )' <INFO>book1 ' ,size (book1), len (book1)
93
92
write (* ,* )' <INFO>book2 ' ,size (book2), len (book2)
94
- ! if(size(book1).ne.size(book2))then
95
- ! write(*,*)'<ERROR>manual and appended pages are not the same size'
96
- ! tally=[tally,.false.]
97
- ! else
98
- ! if(all(book1.ne.book2))then
99
- ! tally=[tally,.false.]
100
- ! write(*,*)'<ERROR>manual and appended pages are not the same'
101
- ! else
102
- ! write(*,*)'<INFO>manual and appended pages are the same'
103
- ! tally=[tally,.true.]
104
- ! endif
105
- ! endif
93
+ if (size (book1).ne. size (book2))then
94
+ write (* ,* )' <ERROR>manual and appended pages are not the same size'
95
+ tally= [tally,.false. ]
96
+ else
97
+ if (all (book1.ne. book2))then
98
+ tally= [tally,.false. ]
99
+ write (* ,* )' <ERROR>manual and appended pages are not the same'
100
+ else
101
+ write (* ,* )' <INFO>manual and appended pages are the same'
102
+ tally= [tally,.true. ]
103
+ endif
104
+ endif
106
105
107
106
! overall size of manual
108
- chars= size (book2)
109
- lines= max (count (char (10 ).eq. book2),count (char (13 ).eq. book2))
107
+ ! chars=size(book2)
108
+ ! lines=max(count(char(10).eq.book2),count(char(13).eq.book2))
109
+ chars= size (book2)* len (book2)
110
+ lines= size (book2)
110
111
if ( (chars.lt. 13000 ) .or. (lines.lt. 350 ) )then
111
112
write (* ,* )' <ERROR>manual is suspiciously small, bytes=' ,chars,' lines=' ,lines
112
113
tally= [tally,.false. ]
@@ -127,17 +128,6 @@ program help_test
127
128
write (* ,' (g0:,1x)' )' <INFO>TEST help SUBCOMMAND COMPLETE'
128
129
contains
129
130
130
- function bugcount (page ,string )
131
- character (len=* ),intent (in ) :: page(:)
132
- character (len=* ),intent (in ) :: string
133
- integer :: bugcount
134
- integer :: i
135
- bugcount= 0
136
- do i = 1 ,size (page)
137
- if (page(i).eq. string)bugcount= bugcount+1
138
- enddo
139
- end function bugcount
140
-
141
131
subroutine wipe (filename )
142
132
character (len=* ),intent (in ) :: filename
143
133
integer :: ios
@@ -197,7 +187,7 @@ subroutine swallow(FILENAME,pageout)
197
187
implicit none
198
188
character (len=* ),intent (in ) :: FILENAME ! file to read
199
189
! intel-bug!character(len=:),allocatable,intent(out) :: pageout(:) ! page to hold file in memory
200
- character (len= 132 ),allocatable ,intent (out ) :: pageout(:) ! page to hold file in memory
190
+ character (len= : ),allocatable ,intent (out ) :: pageout(:) ! page to hold file in memory
201
191
character (len= 1 ),allocatable :: text(:) ! array to hold file in memory
202
192
203
193
call slurp(FILENAME,text) ! allocate character array and copy file into it
@@ -216,7 +206,7 @@ function page(array) result (table)
216
206
217
207
character (len= 1 ),intent (in ) :: array(:)
218
208
! intel-bug!character(len=:),allocatable :: table(:)
219
- character (len= 132 ),allocatable :: table(:)
209
+ character (len= : ),allocatable :: table(:)
220
210
integer :: i
221
211
integer :: linelength
222
212
integer :: length
@@ -248,7 +238,7 @@ function page(array) result (table)
248
238
249
239
if (allocated (table))deallocate (table)
250
240
! intel-bug!allocate(character(len=linelength) :: table(lines))
251
- allocate (character (len= 132 ) :: table(lines))
241
+ allocate (character (len= linelength ) :: table(lines))
252
242
table= ' '
253
243
linecount= 1
254
244
position= 1
0 commit comments