Skip to content

Commit 3c03802

Browse files
committed
Improve test names
1 parent 088ae49 commit 3c03802

File tree

1 file changed

+74
-74
lines changed

1 file changed

+74
-74
lines changed

test/fpm_test/test_package_dependencies.f90

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ subroutine collect_package_dependencies(tests)
4646
& new_unittest("add-dependencies", test_add_dependencies), &
4747
& new_unittest("registry-dir-not-found", registry_dir_not_found, should_fail=.true.), &
4848
& 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), &
6161
& new_unittest("pkg-data-no-code", pkg_data_no_code, should_fail=.true.), &
6262
& new_unittest("pkg-data-corrupt-code", pkg_data_corrupt_code, should_fail=.true.), &
6363
& 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)
338338

339339
end subroutine no_versions_in_registry
340340

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)
343343
type(error_t), allocatable, intent(out) :: error
344344

345345
type(toml_table) :: table
@@ -381,10 +381,10 @@ subroutine version_not_found_in_registry(error)
381381

382382
call delete_tmp_folder
383383

384-
end subroutine version_not_found_in_registry
384+
end subroutine local_registry_specified_version_not_found
385385

386386
!> Target package in path registry does not contain manifest.
387-
subroutine version_found_without_manifest(error)
387+
subroutine local_registry_specified_no_manifest(error)
388388
type(error_t), allocatable, intent(out) :: error
389389

390390
type(toml_table) :: table
@@ -427,10 +427,10 @@ subroutine version_found_without_manifest(error)
427427

428428
call delete_tmp_folder
429429

430-
end subroutine version_found_without_manifest
430+
end subroutine local_registry_specified_no_manifest
431431

432432
!> Target package in path registry contains manifest.
433-
subroutine version_found_with_manifest(error)
433+
subroutine local_registry_specified_has_manifest(error)
434434
type(error_t), allocatable, intent(out) :: error
435435

436436
type(toml_table) :: table
@@ -484,10 +484,10 @@ subroutine version_found_with_manifest(error)
484484

485485
call delete_tmp_folder
486486

487-
end subroutine version_found_with_manifest
487+
end subroutine local_registry_specified_has_manifest
488488

489489
!> Target is a file, not a directory.
490-
subroutine not_a_dir(error)
490+
subroutine local_registry_specified_not_a_dir(error)
491491
type(error_t), allocatable, intent(out) :: error
492492

493493
type(toml_table) :: table
@@ -528,11 +528,11 @@ subroutine not_a_dir(error)
528528

529529
call delete_tmp_folder
530530

531-
end subroutine not_a_dir
531+
end subroutine local_registry_specified_not_a_dir
532532

533533
!> Try fetching the latest version in the local registry, but none are found.
534534
!> 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)
536536
type(error_t), allocatable, intent(out) :: error
537537

538538
type(toml_table) :: table
@@ -572,10 +572,10 @@ subroutine no_versions_found(error)
572572

573573
call delete_tmp_folder
574574

575-
end subroutine no_versions_found
575+
end subroutine local_registry_unspecified_no_versions
576576

577577
!> 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)
579579
type(error_t), allocatable, intent(out) :: error
580580

581581
type(toml_table) :: table
@@ -627,10 +627,10 @@ subroutine newest_version_without_manifest(error)
627627

628628
call delete_tmp_folder
629629

630-
end subroutine newest_version_without_manifest
630+
end subroutine local_registry_unspecified_no_manifest
631631

632632
!> Latest version in the local registry has a manifest.
633-
subroutine newest_version_with_manifest(error)
633+
subroutine local_registry_unspecified_has_manifest(error)
634634
type(error_t), allocatable, intent(out) :: error
635635

636636
type(toml_table) :: table
@@ -683,31 +683,33 @@ subroutine newest_version_with_manifest(error)
683683

684684
call delete_tmp_folder
685685

686-
end subroutine newest_version_with_manifest
686+
end subroutine local_registry_unspecified_has_manifest
687687

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)
690690
type(error_t), allocatable, intent(out) :: error
691691

692692
type(toml_table) :: table
693693
type(dependency_node_t) :: node
694694
type(fpm_global_settings) :: global_settings
695-
character(len=:), allocatable :: target_dir, cwd
695+
character(len=:), allocatable :: target_dir, cwd, path
696696
type(toml_table), pointer :: child
697-
type(mock_downloader_t) :: mock_downloader
698697

699698
call new_table(table)
700699
table%key = 'test-dep'
701700
call set_value(table, 'namespace', 'test-org')
701+
call set_value(table, 'v', '2.3.0')
702702

703703
call new_dependency(node%dependency_config_t, table, error=error)
704704
if (allocated(error)) return
705705

706706
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'), [''])
708710

709711
call new_table(table)
710-
call add_table(table, 'registry', child)
712+
call add_table(table, 'registry', child) ! No cache_path specified, use default
711713

712714
call setup_global_settings(global_settings, error)
713715
if (allocated(error)) then
@@ -719,7 +721,7 @@ subroutine get_newest_version_from_registry(error)
719721
call delete_tmp_folder; return
720722
end if
721723

722-
call node%get_from_registry(target_dir, global_settings, error, mock_downloader)
724+
call node%get_from_registry(target_dir, global_settings, error)
723725
if (allocated(error)) then
724726
call delete_tmp_folder; return
725727
end if
@@ -729,40 +731,39 @@ subroutine get_newest_version_from_registry(error)
729731
call delete_tmp_folder; return
730732
end if
731733

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
733735
call test_failed(error, "Target directory not set correctly: '"//target_dir//"'")
734736
call delete_tmp_folder; return
735737
end if
736738

737739
call delete_tmp_folder
738740

739-
end subroutine get_newest_version_from_registry
741+
end subroutine cache_specified_version_found
740742

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)
743745
type(error_t), allocatable, intent(out) :: error
744746

745747
type(toml_table) :: table
746748
type(dependency_node_t) :: node
747749
type(fpm_global_settings) :: global_settings
748-
character(len=:), allocatable :: target_dir, cwd, path
750+
character(len=:), allocatable :: target_dir, cwd
749751
type(toml_table), pointer :: child
752+
type(mock_downloader_t) :: mock_downloader
750753

751754
call new_table(table)
752755
table%key = 'test-dep'
753756
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')
755758

756759
call new_dependency(node%dependency_config_t, table, error=error)
757760
if (allocated(error)) return
758761

759762
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
763764

764765
call new_table(table)
765-
call add_table(table, 'registry', child) ! No cache_path specified, use default
766+
call add_table(table, 'registry', child)
766767

767768
call setup_global_settings(global_settings, error)
768769
if (allocated(error)) then
@@ -774,7 +775,7 @@ subroutine version_found_in_cache(error)
774775
call delete_tmp_folder; return
775776
end if
776777

777-
call node%get_from_registry(target_dir, global_settings, error)
778+
call node%get_from_registry(target_dir, global_settings, error, mock_downloader)
778779
if (allocated(error)) then
779780
call delete_tmp_folder; return
780781
end if
@@ -784,36 +785,36 @@ subroutine version_found_in_cache(error)
784785
call delete_tmp_folder; return
785786
end if
786787

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
788789
call test_failed(error, "Target directory not set correctly: '"//target_dir//"'")
789790
call delete_tmp_folder; return
790791
end if
791792

792793
call delete_tmp_folder
793794

794-
end subroutine version_found_in_cache
795+
end subroutine registry_specified_version_not_found_in_cache
795796

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)
798799
type(error_t), allocatable, intent(out) :: error
799800

800801
type(toml_table) :: table
801802
type(dependency_node_t) :: node
802803
type(fpm_global_settings) :: global_settings
803-
character(len=:), allocatable :: target_dir, cwd
804+
character(len=:), allocatable :: target_dir
804805
type(toml_table), pointer :: child
805806
type(mock_downloader_t) :: mock_downloader
806807

807808
call new_table(table)
808809
table%key = 'test-dep'
809810
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')
811812

812813
call new_dependency(node%dependency_config_t, table, error=error)
813814
if (allocated(error)) return
814815

815816
call delete_tmp_folder
816-
call mkdir(tmp_folder) ! Dependencies folder doesn't exist
817+
call mkdir(tmp_folder)
817818

818819
call new_table(table)
819820
call add_table(table, 'registry', child)
@@ -833,22 +834,11 @@ subroutine no_version_in_default_cache(error)
833834
call delete_tmp_folder; return
834835
end if
835836

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-
846837
call delete_tmp_folder
847838

848-
end subroutine no_version_in_default_cache
839+
end subroutine registry_specified_version_not_exists_anywhere
849840

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)
852842
type(error_t), allocatable, intent(out) :: error
853843

854844
type(toml_table) :: table
@@ -861,13 +851,14 @@ subroutine no_version_in_cache_or_registry(error)
861851
call new_table(table)
862852
table%key = 'test-dep'
863853
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')
865855

866856
call new_dependency(node%dependency_config_t, table, error=error)
867857
if (allocated(error)) return
868858

869859
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'))
871862

872863
call new_table(table)
873864
call add_table(table, 'registry', child)
@@ -889,29 +880,28 @@ subroutine no_version_in_cache_or_registry(error)
889880

890881
call delete_tmp_folder
891882

892-
end subroutine no_version_in_cache_or_registry
883+
end subroutine registry_specified_version_other_versions_exist
893884

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)
895887
type(error_t), allocatable, intent(out) :: error
896888

897889
type(toml_table) :: table
898890
type(dependency_node_t) :: node
899891
type(fpm_global_settings) :: global_settings
900-
character(len=:), allocatable :: target_dir
892+
character(len=:), allocatable :: target_dir, cwd
901893
type(toml_table), pointer :: child
902894
type(mock_downloader_t) :: mock_downloader
903895

904896
call new_table(table)
905897
table%key = 'test-dep'
906898
call set_value(table, 'namespace', 'test-org')
907-
call set_value(table, 'v', '0.1.0')
908899

909900
call new_dependency(node%dependency_config_t, table, error=error)
910901
if (allocated(error)) return
911902

912903
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)
915905

916906
call new_table(table)
917907
call add_table(table, 'registry', child)
@@ -931,9 +921,19 @@ subroutine other_versions_in_default_cache(error)
931921
call delete_tmp_folder; return
932922
end if
933923

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+
934934
call delete_tmp_folder
935935

936-
end subroutine other_versions_in_default_cache
936+
end subroutine registry_unspecified_version
937937

938938
!> Package data returned from the registry does not contain a code field.
939939
subroutine pkg_data_no_code(error)

0 commit comments

Comments
 (0)