Skip to content

Commit

Permalink
Addressed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattBrzezinski committed Apr 6, 2021
1 parent 4c7fbef commit a3816f6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/PkgDeps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ function _get_latest_version(base_path::AbstractString)
if isfile(versions_file_path)
versions_content = parsefile(versions_file_path)
versions = [VersionNumber(v) for v in collect(keys(versions_content))]
sort!(versions, rev=true)

return first(versions)
return first(findmax(versions))
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/resources/registries/Foobar/Case1/Deps.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[0]
UpDep = "000eeb74-f857-587a-a816-be5685e97e75"
DownDep = "000eeb74-f857-587a-a816-be5685e97e75"
2 changes: 1 addition & 1 deletion test/resources/registries/Foobar/Case2/Deps.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
["0.1-0"]
UpDep = "000eeb74-f857-587a-a816-be5685e97e75"
DownDep = "000eeb74-f857-587a-a816-be5685e97e75"
2 changes: 1 addition & 1 deletion test/resources/registries/General/Case3/Deps.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
["1"]
UpDep = "000eeb74-f857-587a-a816-be5685e97e75"
DownDep = "000eeb74-f857-587a-a816-be5685e97e75"
2 changes: 1 addition & 1 deletion test/resources/registries/General/Case4/Deps.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
["0-0.1"]
UpDep = "000eeb74-f857-587a-a816-be5685e97e75"
DownDep = "000eeb74-f857-587a-a816-be5685e97e75"
10 changes: 5 additions & 5 deletions test/resources/registries/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
## Creating test cases
When adding test cases please create another test case in any existing registry.
Include a `Deps.toml` and `Versions.toml` files to specify when a package has been dependent
Include `Deps.toml` and `Versions.toml` files to specify when a package has been dependent
on another.


## Overview of Cases

### Case1
Single patch pre-1.0 release that has always been dependent on `UpDep`.
Single patch pre-1.0 release that has always been dependent on `DownDep`.

### Case2
Single minor pre-1.0 release that has always been dependent on `UpDep`.
Single minor pre-1.0 release that has always been dependent on `DownDep`.

### Case3
Single post-1.0 release that is dependent on `UpDep`.
Single post-1.0 release that is dependent on `DownDep`.

### Case4
Two releases where `UpDep` was previously a depdenency and no longer is.
Two releases where `DownDep` was previously a depdenency and no longer is.
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ end
all_registries = reachable_registries(; depots=depot)

@testset "specific registry" begin
dependents = find_downstream_dependencies("UpDep"; registries=foobar_registry)
dependents = find_downstream_dependencies("DownDep"; registries=foobar_registry)

@test length(dependents) == 2
[@test case in dependents for case in ["Case1", "Case2"]]
end

@testset "all registries" begin
dependents = find_downstream_dependencies("UpDep"; registries=all_registries)
dependents = find_downstream_dependencies("DownDep"; registries=all_registries)

@test length(dependents) == 3
@test !("Case4" in dependents)
Expand Down

0 comments on commit a3816f6

Please sign in to comment.