sundbp-extlib 0.9.14

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