@@ -46,18 +46,18 @@ subroutine collect_package_dependencies(tests)
46
46
& new_unittest(" add-dependencies" , test_add_dependencies), &
47
47
& new_unittest(" registry-dir-not-found" , registry_dir_not_found, should_fail= .true. ), &
48
48
& new_unittest(" no-versions-in-registry" , no_versions_in_registry, should_fail= .true. ), &
49
- & new_unittest(" version-not-found-in-registry " , version_not_found_in_registry , should_fail= .true. ), &
50
- & new_unittest(" version-found-without- manifest" , version_found_without_manifest , should_fail= .true. ), &
51
- & new_unittest(" version-found-with- manifest" , version_found_with_manifest ), &
52
- & new_unittest(" not-a-dir" , not_a_dir , should_fail= .true. ), &
53
- & new_unittest(" no-versions-found " , no_versions_found , should_fail= .true. ), &
54
- & new_unittest(" newest-version-without- manifest" , newest_version_without_manifest , should_fail= .true. ), &
55
- & new_unittest(" newest-version-with- manifest" , newest_version_with_manifest ), &
56
- & new_unittest(" get-newest -version-from-registry " , get_newest_version_from_registry ), &
57
- & new_unittest(" version-found-in-cache" , version_found_in_cache ), &
58
- & new_unittest(" no- version-in-default-cache " , no_version_in_default_cache ), &
59
- & new_unittest(" no- version-in-cache-or-registry " , no_version_in_cache_or_registry, should_fail = .true. ), &
60
- & new_unittest(" other-versions-in-default-cache " , other_versions_in_default_cache ), &
49
+ & new_unittest(" local-registry-specified- version-not-found" , local_registry_specified_version_not_found , should_fail= .true. ), &
50
+ & new_unittest(" local-registry-specified-no- manifest" , local_registry_specified_no_manifest , should_fail= .true. ), &
51
+ & new_unittest(" local-registry-specified-has- manifest" , local_registry_specified_has_manifest ), &
52
+ & new_unittest(" local-registry-specified- not-a-dir" , local_registry_specified_not_a_dir , should_fail= .true. ), &
53
+ & new_unittest(" local-registry-unspecified- no-versions" , local_registry_unspecified_no_versions , should_fail= .true. ), &
54
+ & new_unittest(" local-registry-unspecified-no- manifest" , local_registry_unspecified_no_manifest , should_fail= .true. ), &
55
+ & new_unittest(" local-registry-unspecified-has- manifest" , local_registry_unspecified_has_manifest ), &
56
+ & new_unittest(" cache-specified -version-found " , cache_specified_version_found ), &
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. ), &
59
+ & new_unittest(" registry-specified- version-other-versions-exist " , registry_specified_version_other_versions_exist ), &
60
+ & new_unittest(" registry-unspecified-version " , registry_unspecified_version ), &
61
61
& new_unittest(" pkg-data-no-code" , pkg_data_no_code, should_fail= .true. ), &
62
62
& new_unittest(" pkg-data-corrupt-code" , pkg_data_corrupt_code, should_fail= .true. ), &
63
63
& new_unittest(" pkg-data-missing-error-message" , pkg_data_missing_error_msg, should_fail= .true. ), &
@@ -338,8 +338,8 @@ subroutine no_versions_in_registry(error)
338
338
339
339
end subroutine no_versions_in_registry
340
340
341
- ! > Specific version not found in path registry.
342
- subroutine version_not_found_in_registry (error )
341
+ ! > Specific version not found in the local registry.
342
+ subroutine local_registry_specified_version_not_found (error )
343
343
type (error_t), allocatable , intent (out ) :: error
344
344
345
345
type (toml_table) :: table
@@ -381,10 +381,10 @@ subroutine version_not_found_in_registry(error)
381
381
382
382
call delete_tmp_folder
383
383
384
- end subroutine version_not_found_in_registry
384
+ end subroutine local_registry_specified_version_not_found
385
385
386
386
! > Target package in path registry does not contain manifest.
387
- subroutine version_found_without_manifest (error )
387
+ subroutine local_registry_specified_no_manifest (error )
388
388
type (error_t), allocatable , intent (out ) :: error
389
389
390
390
type (toml_table) :: table
@@ -427,10 +427,10 @@ subroutine version_found_without_manifest(error)
427
427
428
428
call delete_tmp_folder
429
429
430
- end subroutine version_found_without_manifest
430
+ end subroutine local_registry_specified_no_manifest
431
431
432
432
! > Target package in path registry contains manifest.
433
- subroutine version_found_with_manifest (error )
433
+ subroutine local_registry_specified_has_manifest (error )
434
434
type (error_t), allocatable , intent (out ) :: error
435
435
436
436
type (toml_table) :: table
@@ -484,10 +484,10 @@ subroutine version_found_with_manifest(error)
484
484
485
485
call delete_tmp_folder
486
486
487
- end subroutine version_found_with_manifest
487
+ end subroutine local_registry_specified_has_manifest
488
488
489
489
! > Target is a file, not a directory.
490
- subroutine not_a_dir (error )
490
+ subroutine local_registry_specified_not_a_dir (error )
491
491
type (error_t), allocatable , intent (out ) :: error
492
492
493
493
type (toml_table) :: table
@@ -528,11 +528,11 @@ subroutine not_a_dir(error)
528
528
529
529
call delete_tmp_folder
530
530
531
- end subroutine not_a_dir
531
+ end subroutine local_registry_specified_not_a_dir
532
532
533
533
! > Try fetching the latest version in the local registry, but none are found.
534
534
! > Compared to no-versions-in-registry, we aren't requesting a specific version here.
535
- subroutine no_versions_found (error )
535
+ subroutine local_registry_unspecified_no_versions (error )
536
536
type (error_t), allocatable , intent (out ) :: error
537
537
538
538
type (toml_table) :: table
@@ -572,10 +572,10 @@ subroutine no_versions_found(error)
572
572
573
573
call delete_tmp_folder
574
574
575
- end subroutine no_versions_found
575
+ end subroutine local_registry_unspecified_no_versions
576
576
577
577
! > Latest version in the local registry does not have a manifest.
578
- subroutine newest_version_without_manifest (error )
578
+ subroutine local_registry_unspecified_no_manifest (error )
579
579
type (error_t), allocatable , intent (out ) :: error
580
580
581
581
type (toml_table) :: table
@@ -627,10 +627,10 @@ subroutine newest_version_without_manifest(error)
627
627
628
628
call delete_tmp_folder
629
629
630
- end subroutine newest_version_without_manifest
630
+ end subroutine local_registry_unspecified_no_manifest
631
631
632
632
! > Latest version in the local registry has a manifest.
633
- subroutine newest_version_with_manifest (error )
633
+ subroutine local_registry_unspecified_has_manifest (error )
634
634
type (error_t), allocatable , intent (out ) :: error
635
635
636
636
type (toml_table) :: table
@@ -683,31 +683,33 @@ subroutine newest_version_with_manifest(error)
683
683
684
684
call delete_tmp_folder
685
685
686
- end subroutine newest_version_with_manifest
686
+ end subroutine local_registry_unspecified_has_manifest
687
687
688
- ! > No version specified, get the newest version from the registry .
689
- subroutine get_newest_version_from_registry (error )
688
+ ! > Version specified in manifest, version found in cache .
689
+ subroutine cache_specified_version_found (error )
690
690
type (error_t), allocatable , intent (out ) :: error
691
691
692
692
type (toml_table) :: table
693
693
type (dependency_node_t) :: node
694
694
type (fpm_global_settings) :: global_settings
695
- character (len= :), allocatable :: target_dir, cwd
695
+ character (len= :), allocatable :: target_dir, cwd, path
696
696
type (toml_table), pointer :: child
697
- type (mock_downloader_t) :: mock_downloader
698
697
699
698
call new_table(table)
700
699
table% key = ' test-dep'
701
700
call set_value(table, ' namespace' , ' test-org' )
701
+ call set_value(table, ' v' , ' 2.3.0' )
702
702
703
703
call new_dependency(node% dependency_config_t, table, error= error)
704
704
if (allocated (error)) return
705
705
706
706
call delete_tmp_folder
707
- call mkdir(tmp_folder)
707
+ path = join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.3.0' )
708
+ call mkdir(path)
709
+ call filewrite(join_path(path, ' fpm.toml' ), [' ' ])
708
710
709
711
call new_table(table)
710
- call add_table(table, ' registry' , child)
712
+ call add_table(table, ' registry' , child) ! No cache_path specified, use default
711
713
712
714
call setup_global_settings(global_settings, error)
713
715
if (allocated (error)) then
@@ -719,7 +721,7 @@ subroutine get_newest_version_from_registry(error)
719
721
call delete_tmp_folder; return
720
722
end if
721
723
722
- call node% get_from_registry(target_dir, global_settings, error, mock_downloader )
724
+ call node% get_from_registry(target_dir, global_settings, error)
723
725
if (allocated (error)) then
724
726
call delete_tmp_folder; return
725
727
end if
@@ -729,40 +731,39 @@ subroutine get_newest_version_from_registry(error)
729
731
call delete_tmp_folder; return
730
732
end if
731
733
732
- if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 0.1 .0' ))) then
734
+ if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.3 .0' ))) then
733
735
call test_failed(error, " Target directory not set correctly: '" // target_dir// " '" )
734
736
call delete_tmp_folder; return
735
737
end if
736
738
737
739
call delete_tmp_folder
738
740
739
- end subroutine get_newest_version_from_registry
741
+ end subroutine cache_specified_version_found
740
742
741
- ! > Version specified in manifest, version found in cache.
742
- subroutine version_found_in_cache (error )
743
+ ! > Version specified in manifest, but not found in cache. Therefore download dependency .
744
+ subroutine registry_specified_version_not_found_in_cache (error )
743
745
type (error_t), allocatable , intent (out ) :: error
744
746
745
747
type (toml_table) :: table
746
748
type (dependency_node_t) :: node
747
749
type (fpm_global_settings) :: global_settings
748
- character (len= :), allocatable :: target_dir, cwd, path
750
+ character (len= :), allocatable :: target_dir, cwd
749
751
type (toml_table), pointer :: child
752
+ type (mock_downloader_t) :: mock_downloader
750
753
751
754
call new_table(table)
752
755
table% key = ' test-dep'
753
756
call set_value(table, ' namespace' , ' test-org' )
754
- call set_value(table, ' v' , ' 2.3 .0' )
757
+ call set_value(table, ' v' , ' 0.1 .0' )
755
758
756
759
call new_dependency(node% dependency_config_t, table, error= error)
757
760
if (allocated (error)) return
758
761
759
762
call delete_tmp_folder
760
- path = join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.3.0' )
761
- call mkdir(path)
762
- call filewrite(join_path(path, ' fpm.toml' ), [' ' ])
763
+ call mkdir(tmp_folder) ! Dependencies folder doesn't exist
763
764
764
765
call new_table(table)
765
- call add_table(table, ' registry' , child) ! No cache_path specified, use default
766
+ call add_table(table, ' registry' , child)
766
767
767
768
call setup_global_settings(global_settings, error)
768
769
if (allocated (error)) then
@@ -774,7 +775,7 @@ subroutine version_found_in_cache(error)
774
775
call delete_tmp_folder; return
775
776
end if
776
777
777
- call node% get_from_registry(target_dir, global_settings, error)
778
+ call node% get_from_registry(target_dir, global_settings, error, mock_downloader )
778
779
if (allocated (error)) then
779
780
call delete_tmp_folder; return
780
781
end if
@@ -784,36 +785,36 @@ subroutine version_found_in_cache(error)
784
785
call delete_tmp_folder; return
785
786
end if
786
787
787
- if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.3 .0' ))) then
788
+ if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 0.1 .0' ))) then
788
789
call test_failed(error, " Target directory not set correctly: '" // target_dir// " '" )
789
790
call delete_tmp_folder; return
790
791
end if
791
792
792
793
call delete_tmp_folder
793
794
794
- end subroutine version_found_in_cache
795
+ end subroutine registry_specified_version_not_found_in_cache
795
796
796
- ! > Version specified in manifest, but not found in cache. Therefore download dependency .
797
- subroutine no_version_in_default_cache (error )
797
+ ! > Version specified in manifest, but not found in cache or registry .
798
+ subroutine registry_specified_version_not_exists_anywhere (error )
798
799
type (error_t), allocatable , intent (out ) :: error
799
800
800
801
type (toml_table) :: table
801
802
type (dependency_node_t) :: node
802
803
type (fpm_global_settings) :: global_settings
803
- character (len= :), allocatable :: target_dir, cwd
804
+ character (len= :), allocatable :: target_dir
804
805
type (toml_table), pointer :: child
805
806
type (mock_downloader_t) :: mock_downloader
806
807
807
808
call new_table(table)
808
809
table% key = ' test-dep'
809
810
call set_value(table, ' namespace' , ' test-org' )
810
- call set_value(table, ' v' , ' 0.1.0 ' )
811
+ call set_value(table, ' v' , ' 9.9.9 ' )
811
812
812
813
call new_dependency(node% dependency_config_t, table, error= error)
813
814
if (allocated (error)) return
814
815
815
816
call delete_tmp_folder
816
- call mkdir(tmp_folder) ! Dependencies folder doesn't exist
817
+ call mkdir(tmp_folder)
817
818
818
819
call new_table(table)
819
820
call add_table(table, ' registry' , child)
@@ -833,22 +834,11 @@ subroutine no_version_in_default_cache(error)
833
834
call delete_tmp_folder; return
834
835
end if
835
836
836
- call get_current_directory(cwd, error)
837
- if (allocated (error)) then
838
- call delete_tmp_folder; return
839
- end if
840
-
841
- if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 0.1.0' ))) then
842
- call test_failed(error, " Target directory not set correctly: '" // target_dir// " '" )
843
- call delete_tmp_folder; return
844
- end if
845
-
846
837
call delete_tmp_folder
847
838
848
- end subroutine no_version_in_default_cache
839
+ end subroutine registry_specified_version_not_exists_anywhere
849
840
850
- ! > Version specified in manifest, but not found in cache or registry.
851
- subroutine no_version_in_cache_or_registry (error )
841
+ subroutine registry_specified_version_other_versions_exist (error )
852
842
type (error_t), allocatable , intent (out ) :: error
853
843
854
844
type (toml_table) :: table
@@ -861,13 +851,14 @@ subroutine no_version_in_cache_or_registry(error)
861
851
call new_table(table)
862
852
table% key = ' test-dep'
863
853
call set_value(table, ' namespace' , ' test-org' )
864
- call set_value(table, ' v' , ' 9.9.9 ' )
854
+ call set_value(table, ' v' , ' 0.1.0 ' )
865
855
866
856
call new_dependency(node% dependency_config_t, table, error= error)
867
857
if (allocated (error)) return
868
858
869
859
call delete_tmp_folder
870
- call mkdir(tmp_folder)
860
+ call mkdir(join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.1.0' ))
861
+ call mkdir(join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 9.1.0' ))
871
862
872
863
call new_table(table)
873
864
call add_table(table, ' registry' , child)
@@ -889,29 +880,28 @@ subroutine no_version_in_cache_or_registry(error)
889
880
890
881
call delete_tmp_folder
891
882
892
- end subroutine no_version_in_cache_or_registry
883
+ end subroutine registry_specified_version_other_versions_exist
893
884
894
- subroutine other_versions_in_default_cache (error )
885
+ ! > No version specified, get the newest version from the registry.
886
+ subroutine registry_unspecified_version (error )
895
887
type (error_t), allocatable , intent (out ) :: error
896
888
897
889
type (toml_table) :: table
898
890
type (dependency_node_t) :: node
899
891
type (fpm_global_settings) :: global_settings
900
- character (len= :), allocatable :: target_dir
892
+ character (len= :), allocatable :: target_dir, cwd
901
893
type (toml_table), pointer :: child
902
894
type (mock_downloader_t) :: mock_downloader
903
895
904
896
call new_table(table)
905
897
table% key = ' test-dep'
906
898
call set_value(table, ' namespace' , ' test-org' )
907
- call set_value(table, ' v' , ' 0.1.0' )
908
899
909
900
call new_dependency(node% dependency_config_t, table, error= error)
910
901
if (allocated (error)) return
911
902
912
903
call delete_tmp_folder
913
- call mkdir(join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 2.1.0' ))
914
- call mkdir(join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 9.1.0' ))
904
+ call mkdir(tmp_folder)
915
905
916
906
call new_table(table)
917
907
call add_table(table, ' registry' , child)
@@ -931,9 +921,19 @@ subroutine other_versions_in_default_cache(error)
931
921
call delete_tmp_folder; return
932
922
end if
933
923
924
+ call get_current_directory(cwd, error)
925
+ if (allocated (error)) then
926
+ call delete_tmp_folder; return
927
+ end if
928
+
929
+ if (target_dir /= join_path(cwd, join_path(tmp_folder, ' dependencies' , ' test-org' , ' test-dep' , ' 0.1.0' ))) then
930
+ call test_failed(error, " Target directory not set correctly: '" // target_dir// " '" )
931
+ call delete_tmp_folder; return
932
+ end if
933
+
934
934
call delete_tmp_folder
935
935
936
- end subroutine other_versions_in_default_cache
936
+ end subroutine registry_unspecified_version
937
937
938
938
! > Package data returned from the registry does not contain a code field.
939
939
subroutine pkg_data_no_code (error )
0 commit comments