Skip to content

Commit

Permalink
Merge pull request nurugger07#27 from lowks/master
Browse files Browse the repository at this point in the history
Adding more words and correcting an error in the earlier commit
  • Loading branch information
nurugger07 committed Jun 13, 2015
2 parents 988535c + 6676257 commit 6c13c2e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/inflex/pluralize.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ defmodule Inflex.Pluralize do
{ ~r/^tomatoes/i, "tomato"},
{ ~r/^teeth/i, "tooth"},
{ ~r/^lice/i, "louse"},
{ ~r/^quanta/i, "quantum"},
{ ~r/^quanta/i, "quantum"},
{ ~r/^dice/i, "die"},
{ ~r/^feet/i, "foot"},
{ ~r/^phenomena/i, "phenomenon"},
]

@plural_irregular [
Expand All @@ -48,7 +51,10 @@ defmodule Inflex.Pluralize do
{ ~r/^tomato/i, "tomatoes"},
{ ~r/^tooth/i, "teeth"},
{ ~r/^louse/i, "lice"},
{ ~r/^quanta/i, "quantum"},
{ ~r/^quantum/i, "quanta"},
{ ~r/^die/i, "dice"},
{ ~r/^foot/i, "feet"},
{ ~r/^phenomenon/i, "phenomena"},
]

@singular @irregular ++ [
Expand Down
8 changes: 7 additions & 1 deletion test/inflex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ defmodule InflexTest do
assert "specimen" == singularize("specimen")
assert "louse" == singularize("lice")
assert "quantum" == singularize("quanta")
assert "foot" == singularize("feet")
assert "die" == singularize("dice")
assert "phenomenon" == singularize("phenomena")
end

test :pluralize do
Expand All @@ -50,7 +53,10 @@ defmodule InflexTest do
assert "abdomens" == pluralize("abdomen")
assert "specimens" == pluralize("specimen")
assert "lice" == pluralize("louse")
assert "quantum" == singularize("quanta")
assert "quanta" == pluralize("quantum")
assert "feet" == pluralize("foot")
assert "dice" == pluralize("die")
assert "phenomena" == pluralize("phenomenon")
end

test :special_case_nouns_ending_in_o do
Expand Down

0 comments on commit 6c13c2e

Please sign in to comment.