@@ -2,8 +2,8 @@ module test_filesystem
22 use testdrive, only : new_unittest, unittest_type, error_type, check, skip_test
33 use stdlib_system, only: is_directory, delete_file, FS_ERROR, FS_ERROR_CODE, &
44 make_directory, remove_directory, make_directory_all, is_windows, OS_TYPE, &
5- OS_WINDOWS, get_cwd, set_cwd, operator (/ ), exists, fs_type_unknown, &
6- fs_type_regular_file, fs_type_directory, fs_type_symlink, is_regular_file
5+ OS_WINDOWS, get_cwd, set_cwd, operator (/ ), exists, fs_type_unknown, &
6+ fs_type_regular_file, fs_type_directory, fs_type_symlink, is_file
77 use stdlib_error, only: state_type, STDLIB_FS_ERROR
88 use stdlib_strings, only: to_string
99
@@ -22,18 +22,18 @@ subroutine collect_suite(testsuite)
2222 new_unittest(" fs_exists_reg_file" , test_exists_reg_file), &
2323 new_unittest(" fs_exists_dir" , test_exists_dir), &
2424 new_unittest(" fs_exists_symlink" , test_exists_symlink), &
25- new_unittest(" fs_is_regular_file " , test_is_regular_file ), &
25+ new_unittest(" fs_is_file " , test_is_file ), &
2626 new_unittest(" fs_is_directory_dir" , test_is_directory_dir), &
2727 new_unittest(" fs_is_directory_file" , test_is_directory_file), &
2828 new_unittest(" fs_delete_non_existent" , test_delete_file_non_existent), &
2929 new_unittest(" fs_delete_existing_file" , test_delete_file_existing), &
30- new_unittest(" fs_delete_file_being_dir" , test_delete_directory), &
31- new_unittest(" fs_make_dir" , test_make_directory), &
32- new_unittest(" fs_make_dir_existing_dir" , test_make_directory_existing), &
33- new_unittest(" fs_make_dir_all" , test_make_directory_all), &
34- new_unittest(" fs_remove_dir" , test_remove_directory), &
35- new_unittest(" fs_remove_dir_non_existent" , test_remove_directory_nonexistent), &
36- new_unittest(" fs_cwd" , test_cwd) &
30+ new_unittest(" fs_delete_file_being_dir" , test_delete_directory), &
31+ new_unittest(" fs_make_dir" , test_make_directory), &
32+ new_unittest(" fs_make_dir_existing_dir" , test_make_directory_existing), &
33+ new_unittest(" fs_make_dir_all" , test_make_directory_all), &
34+ new_unittest(" fs_remove_dir" , test_remove_directory), &
35+ new_unittest(" fs_remove_dir_non_existent" , test_remove_directory_nonexistent), &
36+ new_unittest(" fs_cwd" , test_cwd) &
3737 ]
3838 end subroutine collect_suite
3939
@@ -108,23 +108,23 @@ subroutine test_exists_reg_file(error)
108108 if (allocated (error)) return
109109 end subroutine test_exists_reg_file
110110
111- subroutine test_is_regular_file (error )
111+ subroutine test_is_file (error )
112112 type (error_type), allocatable , intent (out ) :: error
113113 character (len= 256 ) :: filename
114114 integer :: ios, iunit
115115 character (len= 512 ) :: msg
116116
117- logical :: is_file
117+ logical :: is_reg_file
118118
119119 filename = " test_file.txt"
120120
121121 ! Create a file
122122 open (newunit= iunit, file= filename, status= " replace" , iostat= ios, iomsg= msg)
123- call check(error, ios == 0 , " Cannot init test_is_regular_file : " // trim (msg))
123+ call check(error, ios == 0 , " Cannot init test_is_file : " // trim (msg))
124124 if (allocated (error)) return
125125
126- is_file = is_regular_file (filename)
127- call check(error, is_file , " is_regular_file could not identify a file" )
126+ is_reg_file = is_file (filename)
127+ call check(error, is_reg_file , " is_file could not identify a file" )
128128
129129 if (allocated (error)) then
130130 ! Clean up: remove the file
@@ -137,7 +137,7 @@ subroutine test_is_regular_file(error)
137137 close (iunit,status= ' delete' ,iostat= ios,iomsg= msg)
138138 call check(error, ios == 0 , " Cannot delete test file: " // trim (msg))
139139 if (allocated (error)) return
140- end subroutine test_is_regular_file
140+ end subroutine test_is_file
141141
142142 subroutine test_exists_dir (error )
143143 type (error_type), allocatable , intent (out ) :: error
@@ -293,7 +293,7 @@ subroutine test_is_directory_file(error)
293293 ! Create a file
294294 open (newunit= iunit, file= filename, status= " replace" , iostat= ios, iomsg= msg)
295295 call check(error, ios == 0 , " Cannot create test file: " // trim (msg))
296- if (allocated (error)) return
296+ if (allocated (error)) return
297297
298298 ! Verify `is_directory` identifies it as not a directory
299299 result = is_directory(filename)
@@ -303,7 +303,7 @@ subroutine test_is_directory_file(error)
303303 ! Clean up: remove the file
304304 close (iunit,status= ' delete' ,iostat= ios,iomsg= msg)
305305 call check(error, ios == 0 , " Cannot delete test file: " // trim (msg))
306- if (allocated (error)) return
306+ if (allocated (error)) return
307307
308308 end subroutine test_is_directory_file
309309
@@ -378,10 +378,10 @@ subroutine test_delete_directory(error)
378378 ! Clean up: remove the empty directory
379379 call execute_command_line(' rmdir ' // filename, exitstat= ios, cmdstat= iocmd, cmdmsg= msg)
380380 call check(error, ios== 0 .and. iocmd== 0 , ' Cannot cleanup delete_directory test: ' // trim (msg))
381- if (allocated (error)) return
381+ if (allocated (error)) return
382382
383383 end subroutine test_delete_directory
384-
384+
385385 subroutine test_make_directory (error )
386386 type (error_type), allocatable , intent (out ) :: error
387387 type (state_type) :: err
@@ -471,7 +471,7 @@ subroutine test_remove_directory(error)
471471 call remove_directory(dir_name, err)
472472 call check(error, err% ok(), ' Could not remove directory: ' // err% print ())
473473
474- if (allocated (error)) then
474+ if (allocated (error)) then
475475 ! clean up: remove the empty directory
476476 call execute_command_line(' rmdir ' // dir_name, exitstat= ios, cmdstat= iocmd, cmdmsg= msg)
477477 call check(error, ios== 0 .and. iocmd== 0 , error% message // ' and cannot cleanup make_directory test: ' // trim (msg))
@@ -518,14 +518,14 @@ subroutine test_cwd(error)
518518 call check(error, err% ok(), ' Could not get current working directory: ' // err% print ())
519519 if (allocated (error)) return
520520
521- call check(error, pwd2 == abs_dir_name, ' Working directory is wrong, &
521+ call check(error, pwd2 == abs_dir_name, ' Working directory is wrong, &
522522 & expected: ' // abs_dir_name// " got: " // pwd2)
523523 if (allocated (error)) return
524524
525525 ! cleanup: set the cwd back to the initial value
526526 call set_cwd(pwd1, err)
527527 call check(error, err% ok(), ' Could not clean up cwd test, could not set the cwd back: ' // err% print ())
528- if (allocated (error)) then
528+ if (allocated (error)) then
529529 ! our cwd now is `./test_directory`
530530 ! there is no way of removing the empty test directory
531531 return
0 commit comments