Skip to content

Commit 60a21b4

Browse files
committed
add install command tests
1 parent 9427dc4 commit 60a21b4

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

test/fpm_test/test_installer.f90

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ subroutine collect_installer(testsuite)
3535
& new_unittest("install-sitepackages", test_install_sitepackages), &
3636
& new_unittest("install-mod", test_install_mod), &
3737
& new_unittest("install-exe-unix", test_install_exe_unix), &
38-
& new_unittest("install-exe-win", test_install_exe_win)]
38+
& new_unittest("install-exe-win", test_install_exe_win), &
39+
& new_unittest("install-test-unix", test_install_tests_unix), &
40+
& new_unittest("install-test-win", test_install_tests_win)]
3941

4042
end subroutine collect_installer
4143

@@ -73,6 +75,40 @@ subroutine test_install_exe_win(error)
7375

7476
end subroutine test_install_exe_win
7577

78+
subroutine test_install_tests_unix(error)
79+
!> Error handling
80+
type(error_t), allocatable, intent(out) :: error
81+
82+
type(mock_installer_t) :: mock
83+
type(installer_t) :: installer
84+
85+
call new_installer(installer, prefix="PREFIX", testdir="tdir", verbosity=0, copy="mock")
86+
mock%installer_t = installer
87+
mock%os = OS_LINUX
88+
mock%expected_dir = "PREFIX/tdir"
89+
mock%expected_run = 'mock "name" "'//mock%expected_dir//'"'
90+
91+
call mock%install_test("name", error)
92+
93+
end subroutine test_install_tests_unix
94+
95+
subroutine test_install_tests_win(error)
96+
!> Error handling
97+
type(error_t), allocatable, intent(out) :: error
98+
99+
type(mock_installer_t) :: mock
100+
type(installer_t) :: installer
101+
102+
call new_installer(installer, prefix="PREFIX", testdir="tdir", verbosity=0, copy="mock")
103+
mock%installer_t = installer
104+
mock%os = OS_WINDOWS
105+
mock%expected_dir = "PREFIX\tdir"
106+
mock%expected_run = 'mock "name.exe" "'//mock%expected_dir//'"'
107+
108+
call mock%install_test("name", error)
109+
110+
end subroutine test_install_tests_win
111+
76112
subroutine test_install_lib(error)
77113
!> Error handling
78114
type(error_t), allocatable, intent(out) :: error

0 commit comments

Comments
 (0)