Permalink
Browse files

added bool to assertTypeof types. made assertTypeof mark test as fail…

…ure if invalid type sent.
  • Loading branch information...
1 parent 987dba6 commit f29480463cd8da2a0e7243c2277a00cd2342c38e @gcoop gcoop committed Feb 23, 2011
Showing with 3 additions and 0 deletions.
  1. +2 −0 Resources/helium.js
  2. +1 −0 Resources/tests/test.js
View
@@ -88,11 +88,13 @@ super simple unit testing framework
if (type === 'object' ||
type === 'number' ||
type === 'string' ||
+ type === 'boolean' ||
type === 'undefined') {
return he.test.assert((typeof value === type), description);
} else if (type === 'array') {
return he.test.assert(he.isArray(value), description);
} else {
+ he.test.assert(false, description);
Ti.API.error('[Helium] invalid assertTypeof parameter passed, use: object, number, string or array');
}
};
@@ -49,6 +49,7 @@
he.test.assertTypeof({}, 'object', 'Should be typeof object');
he.test.assertTypeof('foobar', 'string', 'Should be typeof string');
he.test.assertTypeof(123456, 'number', 'Should be typeof number');
+ he.test.assertTypeof(true, 'boolean', 'Should be typeof boolean');
var blah;
he.test.assertTypeof(blah, 'undefined', 'Should be typeof undefined');

0 comments on commit f294804

Please sign in to comment.