Permalink
Browse files

new vows

  • Loading branch information...
1 parent 5d2f13b commit 9018752365562e887a54669e67fe280c12bc29fd @FotoVerite FotoVerite committed Jun 19, 2010
View
@@ -1,7 +0,0 @@
-test:
- @@node types.js
- @@node number.js
- @@node string.js
- @@node inflector.js
-
-.PHONY: test
View
@@ -0,0 +1,4 @@
+require('./getFu-test');
+require('./isFu-test');
+require('./inflector-test');
+require('./toFu-test');
View
@@ -1,4 +0,0 @@
-require('./getFu');
-require('./isFu');
-require('./inflector');
-require('./toFu');
View
@@ -1,20 +0,0 @@
-var FuDate = require('../lib/date');
-var vows = require('../vows/lib/vows'),
- assert = require('assert');
-
-var sys = require('sys');
-
-var format = require('../index');
-
-vows.describe('format.js lib/date').addVows({
- "getMonthNumberFromName()": {
- "on month as string": {
- topic: "march",
- "can get month as number from string":function( n ){
- var result = format.date.getMonths( n );
- assert.equal(1,1);
- }}
- }
-});
-
-sys.puts(FuDate.getParseFunction("1/2/3"));
View
@@ -1,57 +0,0 @@
-
-var vows = require('../vows/lib/vows'),
- assert = require('assert');
-
-var sys = require('sys');
-
-var Format = require('../lib/format');
-var format = require('../index');
-
-vows.describe('format.js lib/types').addVows({
- "toReverse()": {
- "on an array": {
- topic: [1,2,3,4,5],
- "Array has been reversed":function( s ){
- var result = format.format.toReverse( s );
- if( result.toString() == '5,4,3,2,1'){
- assert.ok( true );
- }
- else{
- assert.ok( false, '"' + s + '"' + ' has not been reversed!');
- }
- }
- }
- },
- "on a string": {
- topic: "hello I am reverse",
- "String has been reversed":function( s ){
- var result = format.format.toReverse( s );
- if( result.toString() == 'esrever ma I olleh'){
- assert.ok( true );
- }
- else{
- assert.ok( false, '"' + s + '"' + ' has not been reversed!');
- }
- }
- },
- "on a number": {
- topic: 12345,
- "Number has been reversed":function( s ){
- var result = format.format.toReverse( s );
- if( result.toString() == 54321){
- assert.ok( true );
- }
- else{
- assert.ok( false, '"' + s + '"' + ' has not been reversed!');
- }
- }
- }
-});
-
-sys.puts(Format.formatShuffle([1,2]));
-sys.puts(Format.formatShuffle(12332424));
-sys.puts(Format.formatShuffle("I am a very model man of model major general"));
-
-sys.puts(Format.toReverse([1,2,3,4,5]));
-sys.puts(Format.toReverse(12332424));
-sys.puts(Format.toReverse("I am a very model man of model major general"));
@@ -1,11 +1,11 @@
-var vows = require('../vows/lib/vows'),
+var vows = require('vows'),
assert = require('assert');
var sys = require('sys');
var format = require('../index');
-vows.describe('format.js lib/getFu').addVows({
+vows.describe('format.js lib/getFu').addBatch({
"getKeys()": {
topic: {key1: "87", key2: 87, key3: 98},
"extracted keys":function( f ){
@@ -96,4 +96,4 @@ vows.describe('format.js lib/getFu').addVows({
}
}
-});
+}).run();
@@ -1,4 +1,4 @@
-var vows = require('../vows/lib/vows'),
+var vows = require('vows'),
assert = require('assert');
var sys = require('sys');
@@ -68,5 +68,5 @@ testSuiteBuilder("toDash", [cases.UnderscoresToDashes]);
testSuiteBuilder("toOrdinal", [cases.OrdinalNumbers]);
testSuiteBuilder("toParam", [cases.StringToParameterized])
-vows.describe('format.js lib/inflector').addVows(myVows);
+vows.describe('format.js lib/inflector').addBatch(myVows).run();
@@ -1,5 +1,5 @@
-var vows = require('../vows/lib/vows'),
+var vows = require('vows'),
assert = require('assert');
var sys = require('sys');
@@ -8,14 +8,14 @@ var format = require('../index');
function isNaN(){return true;};
-vows.describe('format.js lib/types').addVows({
+vows.describe('format.js lib/types').addBatch({
"isDefined()": {
"on nothing": {
topic: '',
"undefined is not defined":function( s ){
var result = format.isFu.isDefined( );
if( !result ){
- assert.ok( true );
+ assert.isTrue( true );
}
else{
assert.ok( false, '"' + s + '"' + ' is defined!');
@@ -714,4 +714,4 @@ vows.describe('format.js lib/types').addVows({
}
}
}
-});
+}).run();
View
@@ -1,55 +0,0 @@
-
-var vows = require('../vows/lib/vows'),
- assert = require('assert');
-
-var sys = require('sys');
-
-var format = require('../index');
-
-vows.describe('format.js lib/number').addVows({
- "toNumber()": {
- "on an instance of Number": {
- topic: new Number( 42 ),
- "can format strict number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on a number literal": {
- topic: 42,
- "can format loose number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on a number string": {
- topic: '42',
- "can format string as number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on not a number at all": {
- topic: 'foobar',
- "returns false":function( n ){
- //assert.isNumber( format.number.toNumber( n ) );
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on a number with commas": {
- topic: '1,000,000',
- "can format string with commas as number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on a number with currency symbols": {
- topic: '$42.00',
- "can format money string as number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }},
- "on a number with currency symbols": {
- topic: '$42.00',
- "can format money string as number":function( n ){
- var result = format.types.isNumber( format.number.toNumber( n ) );
- assert.ok( result );
- }}
- }
-});
View
@@ -1,64 +0,0 @@
-
-var vows = require('../vows/lib/vows'),
- assert = require('assert');
-
-var sys = require('sys');
-
-var format = require('../index');
-
-function isNumber( n ){
-
-// sys.puts('isNumber ' + n)
-
- if(n.toString() == 'NaN'){
- return [false, 'NaN, nananana!'];
- }
- if(n instanceof Number){
- return [true, 'WIN!'];
- }
- else{
- return [false, n.toString() + ' is not a number.'];
- }
-}
-
-
-
-// exports.toString(); <= LOL we don't need this right?
-
-
-/*
-getNumbers
-stripLetters
-getLetters
-*/
-/*
-vows.describe('format.js lib/string').addVows({
- "stripNumbers()": {
- "on string with randomly placed numbers": {
- topic: 'kjas(^12p/)^&34mm6',
- "can remove all the numbers":function( s ){
- var result = format.string.stripNumbers( s );
- if( !format.types.isNumber( s ) ){
- assert.ok( true );
- }
- else{
- assert.ok( false, '"' + s + '"' + ' still has numbers in it ');
- }
- }}
- },
- "getNumbers()": {
- "on string with randomly placed numbers": {
- topic: 'kjas(^12p/)^&34mm6',
- "can get all the numbers":function( s ){
- var result = format.string.getNumbers( s );
- if( !format.types.isNumber( s ) ){
- assert.ok( true );
- }
- else{
- assert.ok( false, '"' + s + '"' + ' still has numbers in it ');
- }
- }}
- }
-
-});
-*/
@@ -1,12 +1,12 @@
-var vows = require('../vows/lib/vows'),
+var vows = require('vows'),
assert = require('assert');
var sys = require('sys');
var format = require('../index');
-vows.describe('format.js lib/types').addVows({
+vows.describe('format.js lib/types').addBatch({
"toReverse()": {
"on an array": {
topic: [1,2,3,4,5],
@@ -121,7 +121,7 @@ vows.describe('format.js lib/types').addVows({
}
}
}
-});
+}).run();
sys.puts(format.toFu.toShuffle([1,2]));
sys.puts(format.toFu.toShuffle(12332424));
Oops, something went wrong.

0 comments on commit 9018752

Please sign in to comment.