Permalink
Browse files

Merge branch 'mocha'

  • Loading branch information...
2 parents 510a25c + ef4f933 commit d85210bc0de3d877bfd1493b18e22858c2ace80c @tj committed Aug 3, 2012
Showing with 31 additions and 37 deletions.
  1. +1 −0 .gitignore
  2. +1 −3 Makefile
  3. +3 −0 package.json
  4. +0 −1 support/expresso
  5. +9 −15 test/inflection.en.test.js
  6. +7 −6 test/inflection.es.test.js
  7. +7 −10 test/lingo.test.js
  8. +3 −2 test/translation.test.js
View
@@ -0,0 +1 @@
+node_modules
View
@@ -1,8 +1,6 @@
test:
- @./support/expresso/bin/expresso \
- $(TEST_FLAGS) \
- -I lib
+ @./node_modules/.bin/mocha --ui exports
docs: index.html
View
@@ -4,5 +4,8 @@
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
, "keywords": ["language", "linguistics", "inflection"]
, "main": "./index.js"
+ , "devDependencies": {
+ "mocha": "*"
+ }
, "engines": { "node": ">= 0.2.0" }
}
Submodule expresso deleted from 2ea263
View
@@ -4,33 +4,34 @@
*/
var lingo = require('./..')
+ , assert = require('assert')
, en = lingo.en;
module.exports = {
- 'test .name': function(assert){
+ 'test .name': function(){
assert.equal('English', en.name);
},
- 'test .isUncountable()': function(assert){
+ 'test .isUncountable()': function(){
assert.equal(true, en.isUncountable('moose'));
assert.equal(false, en.isUncountable('person'));
},
- 'test .uncountable()': function(assert){
+ 'test .uncountable()': function(){
delete en.rules.uncountable.foobar;
assert.equal(false, en.isUncountable('foobar'));
en.uncountable('foobar');
assert.equal(true, en.isUncountable('foobar'));
},
- 'test .pluralNumbers()': function(assert){
+ 'test .pluralNumbers()': function(){
delete en.rules.pluralNumbers;
assert.equal(true, en.isPlural(1));
en.pluralNumbers(/[^1]/);
assert.equal(false, en.isPlural(1));
},
- 'test .pluralize()': function(assert){
+ 'test .pluralize()': function(){
assert.equal('ids', en.pluralize('id'));
assert.equal('friends', en.pluralize('friend'));
assert.equal('buses', en.pluralize('bus'));
@@ -73,7 +74,7 @@ module.exports = {
assert.equal('categories', en.pluralize('category'));
},
- 'test .singularize()': function(assert){
+ 'test .singularize()': function(){
assert.equal('paper', en.singularize('paper'));
assert.equal('ox', en.singularize('oxen'));
assert.equal('shoe', en.singularize('shoes'));
@@ -99,26 +100,19 @@ module.exports = {
assert.equal('series', en.singularize('series'));
},
- 'test .isPlural()': function(assert){
+ 'test .isPlural()': function(){
assert.equal(true, en.isPlural('dogs'));
assert.equal(true, en.isPlural('monkies'));
assert.equal(true, en.isPlural('foxes'));
assert.equal(false, en.isPlural('key'));
assert.equal(false, en.isPlural('fox'));
},
- 'test .isSingular()': function(assert){
+ 'test .isSingular()': function(){
assert.equal(true, en.isSingular('fox'));
assert.equal(true, en.isSingular('person'));
assert.equal(true, en.isSingular('dog'));
assert.equal(false, en.isSingular('keys'));
assert.equal(false, en.isSingular('foxes'));
- },
-
- 'test .tabelize()': function(assert){
- assert.equal('user_accounts', en.tabelize('UserAccount'));
- assert.equal('user', en.tabelize('User'));
- assert.equal('monkeys', en.tabelize('Monkey'));
- assert.equal('animals', en.tabelize('Animal'));
}
};
View
@@ -3,43 +3,44 @@
*/
var lingo = require('./..')
+ , assert = require('assert')
, es = lingo.es;
module.exports = {
- 'test .isUncountable()': function(assert){
+ 'test .isUncountable()': function(){
assert.equal(true, es.isUncountable('agua'));
assert.equal(false, es.isUncountable('arbol'));
},
- 'test .pluralNumbers()': function(assert){
+ 'test .pluralNumbers()': function(){
delete es.rules.pluralNumbers;
assert.equal(true, es.isPlural(1));
es.pluralNumbers(/[^1]/);
assert.equal(false, es.isPlural(1));
},
- 'test .pluralize()': function(assert){
+ 'test .pluralize()': function(){
assert.equal('perros', es.pluralize('perro'));
assert.equal('arboles', es.pluralize('arbol'));
assert.equal('cojones', es.pluralize('cojón'));
assert.equal('androides', es.pluralize('androide'));
},
- 'test .singularize()': function(assert){
+ 'test .singularize()': function(){
assert.equal('perro', es.singularize('perros'));
assert.equal('árbol', es.singularize('árboles'));
assert.equal('cojón', es.singularize('cojones'));
assert.equal('androide', es.singularize('androides'));
},
- 'test .isPlural()': function(assert){
+ 'test .isPlural()': function(){
assert.equal(true, es.isPlural('perros'));
assert.equal(true, es.isPlural('árboles'));
assert.equal(true, es.isPlural('cojones'));
assert.equal(true, es.isPlural('androides'));
},
- 'test .isSingular()': function(assert){
+ 'test .isSingular()': function(){
assert.equal(true, es.isSingular('perro'));
assert.equal(true, es.isSingular('árbol'));
assert.equal(true, es.isSingular('cojón'));
View
@@ -3,39 +3,36 @@
* Module dependencies.
*/
-var lingo = require('lingo');
+var lingo = require('lingo')
+ , assert = require('assert');
module.exports = {
- 'test .version': function(assert){
- assert.match(lingo.version, /^\d+\.\d+\.\d+$/);
- },
-
- 'test .capitalize()': function(assert){
+ 'test .capitalize()': function(){
assert.equal('Hello there', lingo.capitalize('hello there'));
assert.equal('Hello There', lingo.capitalize('hello there', true));
},
- 'test .camelcase()': function(assert){
+ 'test .camelcase()': function(){
assert.equal('foo', lingo.camelcase('foo'));
assert.equal('fooBar', lingo.camelcase('foo bar'));
assert.equal('fooBarBaz', lingo.camelcase('foo bar baz'));
assert.equal('base64Encode', lingo.camelcase('base -! 64 encode'));
assert.equal('UserRole', lingo.camelcase('user role', true));
},
- 'test .underscore()': function(assert){
+ 'test .underscore()': function(){
assert.equal('user', lingo.underscore('User'));
assert.equal('user_account', lingo.underscore('UserAccount'))
},
- 'test .join()': function(assert){
+ 'test .join()': function(){
assert.equal('foo', lingo.join(['foo']));
assert.equal('foo and bar', lingo.join(['foo', 'bar']));
assert.equal('foo, bar and baz', lingo.join(['foo', 'bar', 'baz']));
assert.equal('foo, bar or baz', lingo.join(['foo', 'bar', 'baz'], 'or'));
},
- 'test Language mapping': function(assert){
+ 'test Language mapping': function(){
assert.equal('en', lingo.en.code);
}
}
View
@@ -4,6 +4,7 @@
*/
var lingo = require('lingo')
+ , assert = require('assert')
, en = lingo.en;
var fr = new lingo.Language('fr');
@@ -15,13 +16,13 @@ fr.translations = {
};
module.exports = {
- 'test .translate()': function(assert){
+ 'test .translate()': function(){
assert.equal('Hello World', en.translate('Hello World'));
assert.equal('Hello TJ', en.translate('Hello {name}', { name: 'TJ' }));
assert.equal('Hello foo bar', en.translate('Hello {first} {last}', { first: 'foo', last: 'bar' }));
},
- 'test .translate() with translations': function(assert){
+ 'test .translate() with translations': function(){
assert.equal('Bonjour tout le monde', fr.translate('Hello World'));
assert.equal('Bonjour TJ', fr.translate('Hello {name}', { name: 'TJ' }));
assert.equal('Bonjour foo bar', fr.translate('Hello {first} {last}', { first: 'foo', last: 'bar' }));

0 comments on commit d85210b

Please sign in to comment.