Skip to content

Commit

Permalink
Fix but where X.0.Y was registering as a major change
Browse files Browse the repository at this point in the history
  • Loading branch information
aforward committed Sep 8, 2017
1 parent fd19548 commit 03dd6a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mix/tasks/name.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Mix.Tasks.Version.Name do
|> name
end

defp name([_, "0", _]), do: :major
defp name([_, "0", "0"]), do: :major
defp name([_, _, "0"]), do: :minor
defp name(_), do: :patch

Expand Down
2 changes: 2 additions & 0 deletions test/tasks/name_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ defmodule Mix.Tasks.Version.NameTest do
test "name" do
assert :patch == Name.calc("1.2.3")
assert :patch == Name.calc("1.2.30")
assert :patch == Name.calc("2.0.1")

assert :minor == Name.calc("0.1.0")
assert :minor == Name.calc("1.4.0")

assert :major == Name.calc("1.0.0")
assert :major == Name.calc("2.0.0")

end
end

0 comments on commit 03dd6a3

Please sign in to comment.