@@ -55,9 +55,10 @@ subroutine collect_package_dependencies(tests)
55
55
& new_unittest(" local-registry-unspecified-has-manifest" , local_registry_unspecified_has_manifest), &
56
56
& new_unittest(" cache-specified-version-found" , cache_specified_version_found), &
57
57
& new_unittest(" specified-version-not-found-in-cache" , registry_specified_version_not_found_in_cache), &
58
- & new_unittest(" registry-specified-version-not-exists-anywhere " , registry_specified_version_not_exists_anywhere , should_fail= .true. ), &
58
+ & new_unittest(" registry-specified-version-not-exists" , registry_specified_version_not_exists , should_fail= .true. ), &
59
59
& new_unittest(" registry-specified-version-other-versions-exist" , registry_specified_version_other_versions_exist), &
60
60
& new_unittest(" registry-unspecified-version" , registry_unspecified_version), &
61
+ & new_unittest(" registry-unspecified-version_exists_in_cache" , registry_unspecified_version_exists_in_cache), &
61
62
& new_unittest(" pkg-data-no-code" , pkg_data_no_code, should_fail= .true. ), &
62
63
& new_unittest(" pkg-data-corrupt-code" , pkg_data_corrupt_code, should_fail= .true. ), &
63
64
& new_unittest(" pkg-data-missing-error-message" , pkg_data_missing_error_msg, should_fail= .true. ), &
@@ -795,7 +796,7 @@ subroutine registry_specified_version_not_found_in_cache(error)
795
796
end subroutine registry_specified_version_not_found_in_cache
796
797
797
798
! > Version specified in manifest, but not found in cache or registry.
798
- subroutine registry_specified_version_not_exists_anywhere (error )
799
+ subroutine registry_specified_version_not_exists (error )
799
800
type (error_t), allocatable , intent (out ) :: error
800
801
801
802
type (toml_table) :: table
@@ -836,7 +837,7 @@ subroutine registry_specified_version_not_exists_anywhere(error)
836
837
837
838
call delete_tmp_folder
838
839
839
- end subroutine registry_specified_version_not_exists_anywhere
840
+ end subroutine registry_specified_version_not_exists
840
841
841
842
subroutine registry_specified_version_other_versions_exist (error )
842
843
type (error_t), allocatable , intent (out ) :: error
@@ -935,6 +936,63 @@ subroutine registry_unspecified_version(error)
935
936
936
937
end subroutine registry_unspecified_version
937
938
939
+ ! > No version specified, therefore load package data from the registry. Find out that there is a cached version of
940
+ ! > the latest package.
941
+ subroutine registry_unspecified_version_exists_in_cache (error )
942
+ type (error_t), allocatable , intent (out ) :: error
943
+
944
+ type (toml_table) :: table
945
+ type (dependency_node_t) :: node
946
+ type (fpm_global_settings) :: global_settings
947
+ character (len= :), allocatable :: target_dir, cwd
948
+ type (toml_table), pointer :: child
949
+ type (mock_downloader_t) :: mock_downloader
950
+
951
+ call new_table(table)
952
+ table% key = ' test-dep'
953
+ call set_value(table, ' namespace' , ' test-org' )
954
+
955
+ call new_dependency(node% dependency_config_t, table, error= error)
956
+ if (allocated (error)) return
957
+
958
+ call delete_tmp_folder
959
+ call mkdir(join_path(tmp_folder, ' cache' , ' test-org' , ' test-dep' , ' 0.0.0' ))
960
+ call mkdir(join_path(tmp_folder, ' cache' , ' test-org' , ' test-dep' , ' 0.1.0' ))
961
+ call filewrite(join_path(join_path(tmp_folder, ' cache' , ' test-org' , ' test-dep' , ' 0.1.0' ), ' fpm.toml' ), [' ' ])
962
+ call mkdir(join_path(tmp_folder, ' cache' , ' test-org' , ' test-dep' , ' 1.2.1' ))
963
+
964
+ call new_table(table)
965
+ call add_table(table, ' registry' , child)
966
+
967
+ call setup_global_settings(global_settings, error)
968
+ if (allocated (error)) then
969
+ call delete_tmp_folder; return
970
+ end if
971
+
972
+ call get_registry_settings(child, global_settings, error)
973
+ if (allocated (error)) then
974
+ call delete_tmp_folder; return
975
+ end if
976
+
977
+ call node% get_from_registry(target_dir, global_settings, error, mock_downloader)
978
+ if (allocated (error)) then
979
+ call delete_tmp_folder; return
980
+ end if
981
+
982
+ call get_current_directory(cwd, error)
983
+ if (allocated (error)) then
984
+ call delete_tmp_folder; return
985
+ end if
986
+
987
+ if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 0.1.0' ))) then
988
+ call test_failed(error, " Target directory not set correctly: '" // target_dir// " '" )
989
+ call delete_tmp_folder; return
990
+ end if
991
+
992
+ call delete_tmp_folder
993
+
994
+ end subroutine registry_unspecified_version_exists_in_cache
995
+
938
996
! > Package data returned from the registry does not contain a code field.
939
997
subroutine pkg_data_no_code (error )
940
998
type (error_t), allocatable , intent (out ) :: error
0 commit comments