From: Rick Waldron Date: Wed, 8 Dec 2010 20:12:33 +0000 (-0500) Subject: [#208] Implement Popcorn.error(msg); X-Git-Tag: v0.2~56^2~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=bd35aacddd4256622e31b27964358689342ea45b;p=popcorn-js.git [#208] Implement Popcorn.error(msg); --- diff --git a/popcorn.js b/popcorn.js index b6a4587..05de7c1 100644 --- a/popcorn.js +++ b/popcorn.js @@ -79,6 +79,9 @@ // A Few reusable utils, memoized onto Popcorn Popcorn.extend( Popcorn, { + error: function( msg ) { + throw msg; + }, guid: function() { return +new Date() + Math.floor(Math.random()*11); }, diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index a3a85e9..c565953 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -39,17 +39,26 @@ test("API", function () { test("Utility", function () { + expect(6); // TODO: comprehensive tests for these utilities equals( typeof Popcorn.forEach, "function" , "Popcorn.forEach is a provided utility function"); equals( typeof Popcorn.extend, "function" , "Popcorn.extend is a provided utility function"); + equals( typeof Popcorn.error, "function" , "Popcorn.error is a provided utility function"); equals( typeof Popcorn.guid, "function" , "Popcorn.guid is a provided utility function"); equals( typeof Popcorn.sizeOf, "function" , "Popcorn.sizeOf is a provided utility function"); equals( typeof Popcorn.nop, "function" , "Popcorn.nop is a provided utility function"); - + + + + }); + + + + test("Object", function () {