Commits

Anonymous committed 53a8c99

lint

Comments (0)

Files changed (1)

-if(typeof fox === "undefined" || !fox) fox={};
+if (typeof fox === 'undefined' || !fox) fox = {};
 
 /****h* fox.test/fox.test
 * DESCRIPTION
 *
 * COPYRIGHT
 * The MIT License (MIT)
-* 
+*
 * Copyright (c) 2013 Bradley Workman
-* 
+*
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * THE SOFTWARE.
 ******
 *     There are probably more comprehensive test frameworks available, but
-* I wrote this one myself for practice and experience. For production 
+* I wrote this one myself for practice and experience. For production
 * environment testing or commercial grade, I recommend researching a more
 * rigorous framework.
 */
-(function(){
-	if(fox.test) return;
+(function() {
+	if (fox.test) return;
 
         /****f* fox.test/print
         * DESCRIPTION
         */
         function println(msg)
         {
-                print(msg + "\n");
+                print(msg + '\n');
         }
         /*******/
 
                 *
                 * SOURCE
                 */
-                getStack:function(){
-                        var stack = (new Error()).stack.split("\n");
+                getStack: function() {
+                        var stack = (new Error()).stack.split('\n');
 
                         var regexp1 = /at (.*\.)?(.*) \(/i;
                         var regexp2 = /([\d]+):([\d]+)\)/i;
 
-                        for(var i=stack.length-1; i>=0; i--)
+                        for (var i = stack.length - 1; i >= 0; i--)
                         {
                                 var func = regexp1.exec(stack[i]);
                                 var pos = regexp2.exec(stack[i]);
 
-                                if(!func || !pos)
-                                        stack.splice(i,1);
+                                if (!func || !pos)
+                                        stack.splice(i, 1);
                                 else
-                                        stack[i] = {caller:func[2],line:pos[1], chr:[2]};
+                                        stack[i] = {caller: func[2], line: pos[1], chr: [2]};
                         }
 
                         // remove the call to getStack()
-                        stack.splice(0,1);
+                        stack.splice(0, 1);
                         return stack;
                 },
                 /*******/
-                
+
                 /****f* fox.test/assert
                 * DESCRIPTION
                 *       public -- performs an equivelance test
                 * and throws an error if the relation fails.
                 *
                 * PARAMETERS
-                *       (obj) a          -- if 'b' and 'strict' are  undefined, assert tests that 
+                *       (obj) a          -- if 'b' and 'strict' are  undefined, assert tests that
                 * 'a' === 'true', else 'a' will be compared to 'b'
                 *
                 *       (obj) b          -- object to compare to 'a'
                 *
                 * SOURCE
                 */
-                assert:function(a,b,strict){
+                assert: function(a,b,strict) {
 
-                        if(typeof b === "undefined")
+                        if (typeof b === 'undefined')
                         {
-                                if(a) return;
+                                if (a) return;
 
                                 var stack = fox.test.getStack();
-                                if(!stack) throw new Error(a);
+                                if (!stack) throw new Error(a);
                                 throw new Error(JSON.stringify({
                                         function: stack[1].caller,
                                         line: stack[1].line
 
                         if(typeof strict === "undefined") strict = false;
 
-                        if((strict && a !== b) || (!strict && a != b))
+                        if ((strict && a !== b) || (!strict && a != b))
                         {
-                                var r = strict ? " !== " : " != ";
+                                var r = strict ? ' !== ' : ' != ';
                                 var stack = fox.test.getStack();
-                                if(!stack) throw new Error(a + r + b);
+                                if (!stack) throw new Error(a + r + b);
 
-                                if(typeof a !== "string")
+                                if (typeof a !== 'string')
                                         a = JSON.stringify(a);
-                                if(typeof b !== "string")
+                                if (typeof b !== 'string')
                                         b = JSON.stringify(b);
 
                                 throw new Error(JSON.stringify({
                                         function: stack[1].caller,
                                         line: stack[1].line,
-                                        assertion:a + r + b
+                                        assertion:a+ r+ b
                                 }));
                         }
 
 
                 /****f* fox.test/run
                 * DESCRIPTION
-                *       public -- runs a set of test functions with
-                * a given scope, prints the results and (possibly) debug
+                * public-- runsasetoftestfunctionswith
+                * agivenscope, printstheresultsand(possibly) debug
                 * information to the current html document.
                 *
                 * PARAMETERS
-                *       (obj) suite       -- expected to be an object with the following
+                * (obj) suite-- expected to be an object with the following
                 * signature:
-                *       {
-                *               __TITLE__:(string),
-                *               __DOC__:(string),
-                *               _init: (function),
-                *               test1: (function),
-                *               test2: (function),
-                *               ...
-                *       }
+                * {
+                * __TITLE__: (string),
+                * __DOC__: (string),
+                * _init: (function),
+                * test1:(function),
+                * test2 : (function),
+                * ...
+                * }
                 *
-                *       (boolean) verbose -- if 'true', debug information is printed
+                *(boolean) verbose-- if 'true', debug information is printed
                 *
                 * SIDE EFFECTS
-                *       see println, print
+                * see println, print
                 *
                 * RESULT
-                *       always returns 'true'
+                * always returns 'true'
                 *
                 * NOTES
-                *       - test functions must be numbered [1,n] continuous
+                * - test functions must be numbered[1, n] continuous
                 *       - result of '_init' will be used as scope for the
                 * calls of 'text<x>'
                 *       - _init can be a variable