Skip to content

Commit 0631665

Browse files
committed
remove debug from help-test
1 parent c96e244 commit 0631665

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

fpm/test/help_test/help_test.f90

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
program help_test
22
use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, stdout=>output_unit, stderr=>error_unit
33
implicit none
4-
integer :: i, j
4+
integer :: i
55
integer :: be, af
66
character(len=:),allocatable :: path
77
integer :: estat, cstat
88
character(len=256) :: message
99
logical,allocatable :: tally(:)
10-
character(len=1),allocatable :: book1(:), book2(:)
10+
character(len=:),allocatable :: book1(:), book2(:)
1111
!intel_bug!character(len=:),allocatable :: page1(:)
12-
character(len=132),allocatable :: page1(:)
12+
character(len=:),allocatable :: page1(:)
1313
integer :: lines
1414
integer :: chars
1515
! run a variety of "fpm help" variations and verify expected files are generated
@@ -55,21 +55,17 @@ program help_test
5555
endif
5656
!!write(*,*)findloc(page1,'NAME').eq.1
5757
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]
6561
af=count(.not.tally)
6662
if(be.ne.af)then
6763
write(*,*)'<ERROR>missing expected sections in ',names(i)
6864
write(*,*)page1(1) ! assuming at least size 1 for debugging mingw
6965
write(*,*)count(page1.eq.'NAME')
7066
write(*,*)count(page1.eq.'SYNOPSIS')
7167
write(*,*)count(page1.eq.'DESCRIPTION')
72-
write(*,'(a)')(trim(page1(j)),j=1,size(page1))
68+
write(*,'(a)')page1
7369
endif
7470
write(*,*)'<INFO>have completed ',count(tally),' tests'
7571
call wipe('fpm_scratch_help.txt')
@@ -87,26 +83,31 @@ program help_test
8783
enddo
8884

8985
! 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)
9291
write(*,*)'<INFO>book1 ',size(book1), len(book1)
9392
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
106105

107106
! 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)
110111
if( (chars.lt.13000) .or. (lines.lt.350) )then
111112
write(*,*)'<ERROR>manual is suspiciously small, bytes=',chars,' lines=',lines
112113
tally=[tally,.false.]
@@ -127,17 +128,6 @@ program help_test
127128
write(*,'(g0:,1x)')'<INFO>TEST help SUBCOMMAND COMPLETE'
128129
contains
129130

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-
141131
subroutine wipe(filename)
142132
character(len=*),intent(in) :: filename
143133
integer :: ios
@@ -197,7 +187,7 @@ subroutine swallow(FILENAME,pageout)
197187
implicit none
198188
character(len=*),intent(in) :: FILENAME ! file to read
199189
!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
201191
character(len=1),allocatable :: text(:) ! array to hold file in memory
202192

203193
call slurp(FILENAME,text) ! allocate character array and copy file into it
@@ -216,7 +206,7 @@ function page(array) result (table)
216206

217207
character(len=1),intent(in) :: array(:)
218208
!intel-bug!character(len=:),allocatable :: table(:)
219-
character(len=132),allocatable :: table(:)
209+
character(len=:),allocatable :: table(:)
220210
integer :: i
221211
integer :: linelength
222212
integer :: length
@@ -248,7 +238,7 @@ function page(array) result (table)
248238

249239
if(allocated(table))deallocate(table)
250240
!intel-bug!allocate(character(len=linelength) :: table(lines))
251-
allocate(character(len=132) :: table(lines))
241+
allocate(character(len=linelength) :: table(lines))
252242
table=' '
253243
linecount=1
254244
position=1

0 commit comments

Comments
 (0)