Skip to content

Commit 4ec8097

Browse files
committed
better test fail messages
1 parent cd61274 commit 4ec8097

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/system/test_filesystem.f90

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module test_filesystem
44
make_directory, remove_directory, make_directory_all, is_windows, OS_TYPE, &
55
OS_WINDOWS, exists, type_unknown, type_regular_file, type_directory, type_symlink
66
use stdlib_error, only: state_type, STDLIB_FS_ERROR
7+
use stdlib_strings, only: to_string
78

89
implicit none
910

@@ -88,7 +89,8 @@ subroutine test_exists_reg_file(error)
8889
return
8990
end if
9091

91-
call check(error, t == type_regular_file, "exists incorrectly identifies type of reg files!")
92+
call check(error, t == type_regular_file, "exists incorrectly identifies type of &
93+
reg files!: type=" // to_string(t))
9294

9395
if (allocated(error)) then
9496
! Clean up: remove the file
@@ -123,17 +125,18 @@ subroutine test_exists_dir(error)
123125
if (allocated(error)) then
124126
! Clean up: remove the directory
125127
call execute_command_line("rmdir " // dirname, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
126-
call check(error, ios == 0 .and. iocmd == 0, err%message // "and &
128+
call check(error, ios == 0 .and. iocmd == 0, err%message // " and &
127129
& cannot cleanup test_exists_dir: " // trim(msg))
128130
return
129131
end if
130132

131-
call check(error, t == type_directory, "exists incorrectly identifies type of directories!")
133+
call check(error, t == type_directory, "exists incorrectly identifies type of &
134+
directories!: type=" // to_string(t))
132135

133136
if (allocated(error)) then
134137
! Clean up: remove the directory
135138
call execute_command_line("rmdir " // dirname, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
136-
call check(error, ios == 0 .and. iocmd == 0, err%message // "and &
139+
call check(error, ios == 0 .and. iocmd == 0, err%message // " and &
137140
& cannot cleanup test_exists_dir: " // trim(msg))
138141
return
139142
end if
@@ -184,17 +187,18 @@ subroutine test_exists_symlink(error)
184187
return
185188
end if
186189

187-
call check(error, t == type_symlink, "exists incorrectly identifies type of symlinks!")
190+
call check(error, t == type_symlink, "exists incorrectly identifies type of &
191+
symlinks!: type=" // to_string(t))
188192

189193
if (allocated(error)) then
190194
! Clean up: remove the link
191195
call execute_command_line("rm " // link_name, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
192-
call check(error, ios == 0 .and. iocmd == 0, err%message // "and &
196+
call check(error, ios == 0 .and. iocmd == 0, err%message // " and &
193197
& cannot delete link: " // trim(msg))
194198

195199
! Clean up: remove the target
196200
close(iunit,status='delete',iostat=ios,iomsg=msg)
197-
call check(error, ios == 0, err%message // "and cannot delete target: " // trim(msg))
201+
call check(error, ios == 0, err%message // " and cannot delete target: " // trim(msg))
198202
return
199203
end if
200204

@@ -205,7 +209,7 @@ subroutine test_exists_symlink(error)
205209
if (allocated(error)) then
206210
! Clean up: remove the target
207211
close(iunit,status='delete',iostat=ios,iomsg=msg)
208-
call check(error, ios == 0, err%message // "and cannot delete target: " // trim(msg))
212+
call check(error, ios == 0, err%message // " and cannot delete target: " // trim(msg))
209213
end if
210214
end subroutine test_exists_symlink
211215

0 commit comments

Comments
 (0)