robsharp-extlib 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.autotest +21 -0
  2. data/.document +5 -0
  3. data/.gitignore +22 -0
  4. data/LICENSE +47 -0
  5. data/README.rdoc +17 -0
  6. data/Rakefile +28 -0
  7. data/VERSION +1 -0
  8. data/extlib.gemspec +147 -0
  9. data/lib/extlib.rb +50 -0
  10. data/lib/extlib/array.rb +38 -0
  11. data/lib/extlib/assertions.rb +8 -0
  12. data/lib/extlib/blank.rb +89 -0
  13. data/lib/extlib/boolean.rb +11 -0
  14. data/lib/extlib/byte_array.rb +6 -0
  15. data/lib/extlib/class.rb +179 -0
  16. data/lib/extlib/datetime.rb +29 -0
  17. data/lib/extlib/dictionary.rb +433 -0
  18. data/lib/extlib/hash.rb +450 -0
  19. data/lib/extlib/hook.rb +407 -0
  20. data/lib/extlib/inflection.rb +442 -0
  21. data/lib/extlib/lazy_array.rb +453 -0
  22. data/lib/extlib/lazy_module.rb +18 -0
  23. data/lib/extlib/logger.rb +198 -0
  24. data/lib/extlib/mash.rb +157 -0
  25. data/lib/extlib/module.rb +51 -0
  26. data/lib/extlib/nil.rb +5 -0
  27. data/lib/extlib/numeric.rb +5 -0
  28. data/lib/extlib/object.rb +178 -0
  29. data/lib/extlib/object_space.rb +13 -0
  30. data/lib/extlib/pathname.rb +20 -0
  31. data/lib/extlib/pooling.rb +235 -0
  32. data/lib/extlib/rubygems.rb +38 -0
  33. data/lib/extlib/simple_set.rb +66 -0
  34. data/lib/extlib/string.rb +176 -0
  35. data/lib/extlib/struct.rb +17 -0
  36. data/lib/extlib/symbol.rb +21 -0
  37. data/lib/extlib/time.rb +44 -0
  38. data/lib/extlib/try_dup.rb +44 -0
  39. data/lib/extlib/virtual_file.rb +10 -0
  40. data/spec/array_spec.rb +40 -0
  41. data/spec/blank_spec.rb +86 -0
  42. data/spec/byte_array_spec.rb +8 -0
  43. data/spec/class_spec.rb +158 -0
  44. data/spec/datetime_spec.rb +22 -0
  45. data/spec/hash_spec.rb +536 -0
  46. data/spec/hook_spec.rb +1235 -0
  47. data/spec/inflection/plural_spec.rb +565 -0
  48. data/spec/inflection/singular_spec.rb +498 -0
  49. data/spec/inflection_extras_spec.rb +111 -0
  50. data/spec/lazy_array_spec.rb +1961 -0
  51. data/spec/lazy_module_spec.rb +38 -0
  52. data/spec/mash_spec.rb +312 -0
  53. data/spec/module_spec.rb +71 -0
  54. data/spec/object_space_spec.rb +10 -0
  55. data/spec/object_spec.rb +114 -0
  56. data/spec/pooling_spec.rb +511 -0
  57. data/spec/rcov.opts +6 -0
  58. data/spec/simple_set_spec.rb +58 -0
  59. data/spec/spec.opts +4 -0
  60. data/spec/spec_helper.rb +7 -0
  61. data/spec/string_spec.rb +222 -0
  62. data/spec/struct_spec.rb +13 -0
  63. data/spec/symbol_spec.rb +9 -0
  64. data/spec/time_spec.rb +31 -0
  65. data/spec/try_call_spec.rb +74 -0
  66. data/spec/try_dup_spec.rb +46 -0
  67. data/spec/virtual_file_spec.rb +22 -0
  68. data/tasks/ci.rake +1 -0
  69. data/tasks/metrics.rake +36 -0
  70. data/tasks/spec.rake +25 -0
  71. data/tasks/yard.rake +9 -0
  72. data/tasks/yardstick.rake +19 -0
  73. metadata +198 -0
@@ -0,0 +1,498 @@
1
+ require 'spec_helper'
2
+ require 'extlib/inflection'
3
+
4
+ describe Extlib::Inflection, "#singular" do
5
+ # ==== exceptional cases
6
+
7
+ it "singularizes equipment => equipment" do
8
+ "equipment".singular.should == "equipment"
9
+ end
10
+
11
+ it "singularizes postgres => postgres" do
12
+ "postgres".singular.should == "postgres"
13
+ end
14
+
15
+ it "singularizes mysql => mysql" do
16
+ "mysql".singular.should == "mysql"
17
+ end
18
+
19
+ it "singularizes information => information" do
20
+ "information".singular.should == "information"
21
+ end
22
+
23
+ it "singularizes money => money" do
24
+ "money".singular.should == "money"
25
+ end
26
+
27
+ it "singularizes species => species" do
28
+ "species".singular.should == "species"
29
+ end
30
+
31
+ it "singularizes series => series" do
32
+ "series".singular.should == "series"
33
+ end
34
+
35
+ it "singularizes fish => fish" do
36
+ "fish".singular.should == "fish"
37
+ end
38
+
39
+ it "singularizes sheep => sheep" do
40
+ "sheep".singular.should == "sheep"
41
+ end
42
+
43
+ it "singularizes news => news" do
44
+ "news".singular.should == "news"
45
+ end
46
+
47
+ it "singularizes rain => rain" do
48
+ "rain".singular.should == "rain"
49
+ end
50
+
51
+ it "singularizes milk => milk" do
52
+ "milk".singular.should == "milk"
53
+ end
54
+
55
+ it "singularizes moose => moose" do
56
+ "moose".singular.should == "moose"
57
+ end
58
+
59
+ it "singularizes hovercraft => hovercraft" do
60
+ "hovercraft".singular.should == "hovercraft"
61
+ end
62
+
63
+ it "singularizes cactus => cacti" do
64
+ "cacti".singular.should == "cactus"
65
+ end
66
+
67
+ it "singularizes thesauri => thesaurus" do
68
+ "thesauri".singular.should == "thesaurus"
69
+ end
70
+
71
+ it "singularizes matrices => matrix" do
72
+ "matrices".singular.should == "matrix"
73
+ end
74
+
75
+ it "singularizes Swiss => Swiss" do
76
+ "Swiss".singular.should == "Swiss"
77
+ end
78
+
79
+ it "singularizes lives => life" do
80
+ "lives".singular.should == "life"
81
+ end
82
+
83
+ it "singularizes wives => wife" do
84
+ "wives".singular.should == "wife"
85
+ end
86
+
87
+ it "singularizes geese => goose" do
88
+ "geese".singular.should == "goose"
89
+ end
90
+
91
+ it "singularizes criteria => criterion" do
92
+ "criteria".singular.should == "criterion"
93
+ end
94
+
95
+ it "singularizes aliases => alias" do
96
+ "aliases".singular.should == "alias"
97
+ end
98
+
99
+ it "singularizes statuses => status" do
100
+ "statuses".singular.should == "status"
101
+ end
102
+
103
+ it "singularizes axes => axis" do
104
+ "axes".singular.should == "axis"
105
+ end
106
+
107
+ it "singularizes crises => crisis" do
108
+ "crises".singular.should == "crisis"
109
+ end
110
+
111
+ it "singularizes testes => testis" do
112
+ "testes".singular.should == "testis"
113
+ end
114
+
115
+ it "singularizes children => child" do
116
+ "children".singular.should == "child"
117
+ end
118
+
119
+ it "singularizes people => person" do
120
+ "people".singular.should == "person"
121
+ end
122
+
123
+ it "singularizes potatoes => potato" do
124
+ "potatoes".singular.should == "potato"
125
+ end
126
+
127
+ it "singularizes tomatoes => tomato" do
128
+ "tomatoes".singular.should == "tomato"
129
+ end
130
+
131
+ it "singularizes buffaloes => buffalo" do
132
+ "buffaloes".singular.should == "buffalo"
133
+ end
134
+
135
+ it "singularizes torpedoes => torpedo" do
136
+ "torpedoes".singular.should == "torpedo"
137
+ end
138
+
139
+ it "singularizes quizzes => quiz" do
140
+ "quizzes".singular.should == "quiz"
141
+ end
142
+
143
+ # used to be a bug exposed by this specs suite,
144
+ # this MUST pass or we've got regression
145
+ it "singularizes vertices => vertex" do
146
+ "vertices".singular.should == "vertex"
147
+ end
148
+
149
+ it "singularizes indices => index" do
150
+ "indices".singular.should == "index"
151
+ end
152
+
153
+ it "singularizes oxen => ox" do
154
+ "oxen".singular.should == "ox"
155
+ end
156
+
157
+ it "singularizes mice => mouse" do
158
+ "mice".singular.should == "mouse"
159
+ end
160
+
161
+ it "singularizes lice => louse" do
162
+ "lice".singular.should == "louse"
163
+ end
164
+
165
+ it "singularizes theses => thesis" do
166
+ "theses".singular.should == "thesis"
167
+ end
168
+
169
+ it "singularizes thieves => thief" do
170
+ "thieves".singular.should == "thief"
171
+ end
172
+
173
+ it "singularizes analyses => analysis" do
174
+ "analyses".singular.should == "analysis"
175
+ end
176
+
177
+ it "singularizes octopi => octopus" do
178
+ "octopi".singular.should == "octopus"
179
+ end
180
+
181
+ it "singularizes grass => grass" do
182
+ "grass".singular.should == "grass"
183
+ end
184
+
185
+ it "singularizes phenomena => phenomenon" do
186
+ "phenomena".singular.should == "phenomenon"
187
+ end
188
+
189
+
190
+
191
+
192
+
193
+ # ==== bugs, typos and reported issues
194
+
195
+
196
+
197
+
198
+
199
+ # ==== rules
200
+
201
+ it "singularizes forums => forum" do
202
+ "forums".singular.should == "forum"
203
+ end
204
+
205
+ it "singularizes hives => hive" do
206
+ "hives".singular.should == "hive"
207
+ end
208
+
209
+ it "singularizes athletes => athlete" do
210
+ "athletes".singular.should == "athlete"
211
+ end
212
+
213
+ it "singularizes dwarves => dwarf" do
214
+ "dwarves".singular.should == "dwarf"
215
+ end
216
+
217
+ it "singularizes heroes => hero" do
218
+ "heroes".singular.should == "hero"
219
+ end
220
+
221
+ it "singularizes zeroes => zero" do
222
+ "zeroes".singular.should == "zero"
223
+ end
224
+
225
+ it "singularizes men => man" do
226
+ "men".singular.should == "man"
227
+ end
228
+
229
+ it "singularizes women => woman" do
230
+ "women".singular.should == "woman"
231
+ end
232
+
233
+ it "singularizes sportsmen => sportsman" do
234
+ "sportsmen".singular.should == "sportsman"
235
+ end
236
+
237
+ it "singularizes branches => branch" do
238
+ "branches".singular.should == "branch"
239
+ end
240
+
241
+ it "singularizes crunches => crunch" do
242
+ "crunches".singular.should == "crunch"
243
+ end
244
+
245
+ it "singularizes trashes => trash" do
246
+ "trashes".singular.should == "trash"
247
+ end
248
+
249
+ it "singularizes mashes => mash" do
250
+ "mashes".singular.should == "mash"
251
+ end
252
+
253
+ it "singularizes crosses => cross" do
254
+ "crosses".singular.should == "cross"
255
+ end
256
+
257
+ it "singularizes errata => erratum" do
258
+ "errata".singular.should == "erratum"
259
+ end
260
+
261
+ # FIXME: add -ia => -ium cases
262
+
263
+ # FIXME: add -ra => -rum cases
264
+
265
+ it "singularizes rays => ray" do
266
+ "rays".singular.should == "ray"
267
+ end
268
+
269
+ it "singularizes sprays => spray" do
270
+ "sprays".singular.should == "spray"
271
+ end
272
+
273
+ # Merriam-Webster dictionary says
274
+ # preys is correct, too.
275
+ it "singularizes preys => prey" do
276
+ "preys".singular.should == "prey"
277
+ end
278
+
279
+ it "singularizes toys => toy" do
280
+ "toys".singular.should == "toy"
281
+ end
282
+
283
+ it "singularizes joys => joy" do
284
+ "joys".singular.should == "joy"
285
+ end
286
+
287
+ it "singularizes buys => buy" do
288
+ "buys".singular.should == "buy"
289
+ end
290
+
291
+ it "singularizes guys => guy" do
292
+ "guys".singular.should == "guy"
293
+ end
294
+
295
+ it "singularizes cries => cry" do
296
+ "cries".singular.should == "cry"
297
+ end
298
+
299
+ it "singularizes flies => fly" do
300
+ "flies".singular.should == "fly"
301
+ end
302
+
303
+ it "singularizes foxes => fox" do
304
+ "foxes".singular.should == "fox"
305
+ end
306
+
307
+ it "singularizes elves => elf" do
308
+ "elves".singular.should == "elf"
309
+ end
310
+
311
+ it "singularizes shelves => shelf" do
312
+ "shelves".singular.should == "shelf"
313
+ end
314
+
315
+ it "singularizes pluses => plus" do
316
+ "pluses".singular.should == "plus"
317
+ end
318
+
319
+ it "singularizes cats => cat" do
320
+ "cats".singular.should == "cat"
321
+ end
322
+
323
+ it "singularizes rats => rat" do
324
+ "rats".singular.should == "rat"
325
+ end
326
+
327
+ it "singularizes roses => rose" do
328
+ "roses".singular.should == "rose"
329
+ end
330
+
331
+ it "singularizes projects => project" do
332
+ "projects".singular.should == "project"
333
+ end
334
+
335
+ it "singularizes posts => post" do
336
+ "posts".singular.should == "post"
337
+ end
338
+
339
+ it "singularizes articles => article" do
340
+ "articles".singular.should == "article"
341
+ end
342
+
343
+ it "singularizes locations => location" do
344
+ "locations".singular.should == "location"
345
+ end
346
+
347
+ it "singularizes friends => friend" do
348
+ "friends".singular.should == "friend"
349
+ end
350
+
351
+ it "singularizes links => link" do
352
+ "links".singular.should == "link"
353
+ end
354
+
355
+ it "singularizes urls => url" do
356
+ "urls".singular.should == "url"
357
+ end
358
+
359
+ it "singularizes accounts => account" do
360
+ "accounts".singular.should == "account"
361
+ end
362
+
363
+ it "singularizes servers => server" do
364
+ "servers".singular.should == "server"
365
+ end
366
+
367
+ it "singularizes fruits => fruit" do
368
+ "fruits".singular.should == "fruit"
369
+ end
370
+
371
+ it "singularizes maps => map" do
372
+ "maps".singular.should == "map"
373
+ end
374
+
375
+ it "singularizes incomes => income" do
376
+ "incomes".singular.should == "income"
377
+ end
378
+
379
+ it "singularizes pings => ping" do
380
+ "pings".singular.should == "ping"
381
+ end
382
+
383
+ it "singularizes events => event" do
384
+ "events".singular.should == "event"
385
+ end
386
+
387
+ it "singularizes proofs => proof" do
388
+ "proofs".singular.should == "proof"
389
+ end
390
+
391
+ it "singularizes typos => typo" do
392
+ "typos".singular.should == "typo"
393
+ end
394
+
395
+ it "singularizes attachments => attachment" do
396
+ "attachments".singular.should == "attachment"
397
+ end
398
+
399
+ it "singularizes downloads => download" do
400
+ "downloads".singular.should == "download"
401
+ end
402
+
403
+ it "singularizes assets => asset" do
404
+ "assets".singular.should == "asset"
405
+ end
406
+
407
+ it "singularizes jobs => job" do
408
+ "jobs".singular.should == "job"
409
+ end
410
+
411
+ it "singularizes cities => city" do
412
+ "cities".singular.should == "city"
413
+ end
414
+
415
+ it "singularizes packages => package" do
416
+ "packages".singular.should == "package"
417
+ end
418
+
419
+ it "singularizes commits => commit" do
420
+ "commits".singular.should == "commit"
421
+ end
422
+
423
+ it "singularizes versions => version" do
424
+ "versions".singular.should == "version"
425
+ end
426
+
427
+ it "singularizes documents => document" do
428
+ "documents".singular.should == "document"
429
+ end
430
+
431
+ it "singularizes editions => edition" do
432
+ "editions".singular.should == "edition"
433
+ end
434
+
435
+ it "singularizes movies => movie" do
436
+ "movies".singular.should == "movie"
437
+ end
438
+
439
+ it "singularizes songs => song" do
440
+ "songs".singular.should == "song"
441
+ end
442
+
443
+ it "singularizes invoices => invoice" do
444
+ "invoices".singular.should == "invoice"
445
+ end
446
+
447
+ it "singularizes products => product" do
448
+ "products".singular.should == "product"
449
+ end
450
+
451
+ it "singularizes books => book" do
452
+ "books".singular.should == "book"
453
+ end
454
+
455
+ it "singularizes tickets => ticket" do
456
+ "tickets".singular.should == "ticket"
457
+ end
458
+
459
+ it "singularizes games => game" do
460
+ "games".singular.should == "game"
461
+ end
462
+
463
+ it "singularizes tournaments => tournament" do
464
+ "tournaments".singular.should == "tournament"
465
+ end
466
+
467
+ it "singularizes prizes => prize" do
468
+ "prizes".singular.should == "prize"
469
+ end
470
+
471
+ it "singularizes prices => price" do
472
+ "prices".singular.should == "price"
473
+ end
474
+
475
+ it "singularizes installations => installation" do
476
+ "installations".singular.should == "installation"
477
+ end
478
+
479
+ it "singularizes dates => date" do
480
+ "dates".singular.should == "date"
481
+ end
482
+
483
+ it "singularizes schedules => schedule" do
484
+ "schedules".singular.should == "schedule"
485
+ end
486
+
487
+ it "singularizes arenas => arena" do
488
+ "arenas".singular.should == "arena"
489
+ end
490
+
491
+ it "singularizes spams => spam" do
492
+ "spams".singular.should == "spam"
493
+ end
494
+
495
+ it "singularizes rice => rice" do
496
+ "rice".singular.should == "rice"
497
+ end
498
+ end