Sha256: 72a5e8ae04fa57edf0311c5150c5344331a65a51efda3a8da39941c330c075b7

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 KB

Contents

test("Regular expression escaping a string", function() {
  same('\.+*?[^]$(){}=!<>|:'.escapeForRegExp(), '\\.\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:', "should be escaped");
});

test("Pluralizing a string", function() {
  expect(8);
  same('Goat'.pluralize(), 'Goats', "standard pluralization");
  same('There are many goat'.pluralize(), 'There are many goats', "standard pluralization of a multi-word string");
  same('Bunny'.pluralize(), 'Bunnies', "non-standard pluralization");
  same('I like bunny'.pluralize(), 'I like bunnies', "non-standard pluralization of a multi-word string");
  same('child'.pluralize(), 'children', "irregular pluralization");
  same('I have three child'.pluralize(), 'I have three children', "irregular pluralization of a multi-word string");
  same('sheep'.pluralize(), 'sheep', "uncountable pluralization");
  same('Please hold this sheep'.pluralize(), 'Please hold this sheep', "uncountable pluralization of a multi-word string");
});

test("Singularizing a string", function() {
  expect(8);
  same('Vegetables'.singularize(), 'Vegetable', "standard singularization");
  same('Broccoli is a vegetables'.singularize(), 'Broccoli is a vegetable', "standard singularization of a multi-word string");
  same('Properties'.singularize(), 'Property', "non-standard singularization");
  same('Buy a properties'.singularize(), 'Buy a property', "non-standard singularization of a multi-word string");
  same('people'.singularize(), 'person', "irregular singularization");
  same('The Village People'.singularize(), 'The Village Person', "irregular singularization of a multi-word string");
  same('money'.singularize(), 'money', "uncountable singularization");
  same('Gotta git da money'.singularize(), 'Gotta git da money', "uncountable singularization of a multi-word string");
});

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
spade-0.0.1 sproutcore/frameworks/foundation/tests/mixins/string.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js