;]
[askyou.git] / vendor / rails / activesupport / test / inflector_test_cases.rb
blob584cbff3e7a34a19a48c117ae9c8e5bd6611d2ac
1 # encoding: utf-8
3 module InflectorTestCases
4   SingularToPlural = {
5     "search"      => "searches",
6     "switch"      => "switches",
7     "fix"         => "fixes",
8     "box"         => "boxes",
9     "process"     => "processes",
10     "address"     => "addresses",
11     "case"        => "cases",
12     "stack"       => "stacks",
13     "wish"        => "wishes",
14     "fish"        => "fish",
16     "category"    => "categories",
17     "query"       => "queries",
18     "ability"     => "abilities",
19     "agency"      => "agencies",
20     "movie"       => "movies",
22     "archive"     => "archives",
24     "index"       => "indices",
26     "wife"        => "wives",
27     "safe"        => "saves",
28     "half"        => "halves",
30     "move"        => "moves",
32     "salesperson" => "salespeople",
33     "person"      => "people",
35     "spokesman"   => "spokesmen",
36     "man"         => "men",
37     "woman"       => "women",
39     "basis"       => "bases",
40     "diagnosis"   => "diagnoses",
41     "diagnosis_a" => "diagnosis_as",
43     "datum"       => "data",
44     "medium"      => "media",
45     "analysis"    => "analyses",
47     "node_child"  => "node_children",
48     "child"       => "children",
50     "experience"  => "experiences",
51     "day"         => "days",
53     "comment"     => "comments",
54     "foobar"      => "foobars",
55     "newsletter"  => "newsletters",
57     "old_news"    => "old_news",
58     "news"        => "news",
60     "series"      => "series",
61     "species"     => "species",
63     "quiz"        => "quizzes",
65     "perspective" => "perspectives",
67     "ox"          => "oxen",
68     "photo"       => "photos",
69     "buffalo"     => "buffaloes",
70     "tomato"      => "tomatoes",
71     "dwarf"       => "dwarves",
72     "elf"         => "elves",
73     "information" => "information",
74     "equipment"   => "equipment",
75     "bus"         => "buses",
76     "status"      => "statuses",
77     "status_code" => "status_codes",
78     "mouse"       => "mice",
80     "louse"       => "lice",
81     "house"       => "houses",
82     "octopus"     => "octopi",
83     "virus"       => "viri",
84     "alias"       => "aliases",
85     "portfolio"   => "portfolios",
87     "vertex"      => "vertices",
88     "matrix"      => "matrices",
89     "matrix_fu"   => "matrix_fus",
91     "axis"        => "axes",
92     "testis"      => "testes",
93     "crisis"      => "crises",
95     "rice"        => "rice",
96     "shoe"        => "shoes",
98     "horse"       => "horses",
99     "prize"       => "prizes",
100     "edge"        => "edges",
102     "cow"         => "kine",
103     "database"    => "databases"
104   }
106   CamelToUnderscore = {
107     "Product"               => "product",
108     "SpecialGuest"          => "special_guest",
109     "ApplicationController" => "application_controller",
110     "Area51Controller"      => "area51_controller"
111   }
113   UnderscoreToLowerCamel = {
114     "product"                => "product",
115     "special_guest"          => "specialGuest",
116     "application_controller" => "applicationController",
117     "area51_controller"      => "area51Controller"
118   }
120   CamelToUnderscoreWithoutReverse = {
121     "HTMLTidy"              => "html_tidy",
122     "HTMLTidyGenerator"     => "html_tidy_generator",
123     "FreeBSD"               => "free_bsd",
124     "HTML"                  => "html",
125   }
127   CamelWithModuleToUnderscoreWithSlash = {
128     "Admin::Product" => "admin/product",
129     "Users::Commission::Department" => "users/commission/department",
130     "UsersSection::CommissionDepartment" => "users_section/commission_department",
131   }
133   ClassNameToForeignKeyWithUnderscore = {
134     "Person" => "person_id",
135     "MyApplication::Billing::Account" => "account_id"
136   }
138   ClassNameToForeignKeyWithoutUnderscore = {
139     "Person" => "personid",
140     "MyApplication::Billing::Account" => "accountid"
141   }
143   ClassNameToTableName = {
144     "PrimarySpokesman" => "primary_spokesmen",
145     "NodeChild"        => "node_children"
146   }
148   StringToParameterized = {
149     "Donald E. Knuth"                     => "donald-e-knuth",
150     "Random text with *(bad)* characters" => "random-text-with-bad-characters",
151     "Allow_Under_Scores"                  => "allow_under_scores",
152     "Trailing bad characters!@#"          => "trailing-bad-characters",
153     "!@#Leading bad characters"           => "leading-bad-characters",
154     "Squeeze   separators"                => "squeeze-separators"
155   }
157   StringToParameterizeWithNoSeparator = {
158     "Donald E. Knuth"                     => "donaldeknuth",
159     "Random text with *(bad)* characters" => "randomtextwithbadcharacters",
160     "Trailing bad characters!@#"          => "trailingbadcharacters",
161     "!@#Leading bad characters"           => "leadingbadcharacters",
162     "Squeeze   separators"                => "squeezeseparators"
163   }
165   StringToParameterizeWithUnderscore = {
166     "Donald E. Knuth"                     => "donald_e_knuth",
167     "Random text with *(bad)* characters" => "random_text_with_bad_characters",
168     "Trailing bad characters!@#"          => "trailing_bad_characters",
169     "!@#Leading bad characters"           => "leading_bad_characters",
170     "Squeeze   separators"                => "squeeze_separators"
171   }
173   # Ruby 1.9 doesn't do Unicode normalization yet.
174   if RUBY_VERSION >= '1.9'
175     StringToParameterizedAndNormalized = {
176       "Malmö"                               => "malm",
177       "Garçons"                             => "gar-ons"
178     }
179   else
180     StringToParameterizedAndNormalized = {
181       "Malmö"                               => "malmo",
182       "Garçons"                             => "garcons"
183     }
184   end
186   UnderscoreToHuman = {
187     "employee_salary" => "Employee salary",
188     "employee_id"     => "Employee",
189     "underground"     => "Underground"
190   }
192   MixtureToTitleCase = {
193     'active_record'       => 'Active Record',
194     'ActiveRecord'        => 'Active Record',
195     'action web service'  => 'Action Web Service',
196     'Action Web Service'  => 'Action Web Service',
197     'Action web service'  => 'Action Web Service',
198     'actionwebservice'    => 'Actionwebservice',
199     'Actionwebservice'    => 'Actionwebservice',
200     "david's code"        => "David's Code",
201     "David's code"        => "David's Code",
202     "david's Code"        => "David's Code"
203   }
205   OrdinalNumbers = {
206     "0" => "0th",
207     "1" => "1st",
208     "2" => "2nd",
209     "3" => "3rd",
210     "4" => "4th",
211     "5" => "5th",
212     "6" => "6th",
213     "7" => "7th",
214     "8" => "8th",
215     "9" => "9th",
216     "10" => "10th",
217     "11" => "11th",
218     "12" => "12th",
219     "13" => "13th",
220     "14" => "14th",
221     "20" => "20th",
222     "21" => "21st",
223     "22" => "22nd",
224     "23" => "23rd",
225     "24" => "24th",
226     "100" => "100th",
227     "101" => "101st",
228     "102" => "102nd",
229     "103" => "103rd",
230     "104" => "104th",
231     "110" => "110th",
232     "111" => "111th",
233     "112" => "112th",
234     "113" => "113th",
235     "1000" => "1000th",
236     "1001" => "1001st"
237   }
239   UnderscoresToDashes = {
240     "street"                => "street",
241     "street_address"        => "street-address",
242     "person_street_address" => "person-street-address"
243   }
245   Irregularities = {
246     'person' => 'people',
247     'man'    => 'men',
248     'child'  => 'children',
249     'sex'    => 'sexes',
250     'move'   => 'moves',
251   }