text: /**
   * @depend util/core.js
   * @depend sandbox.js
   */
  /**
   * Test function, sandboxes fakes
   *
   * @author Christian Johansen (christian@cjohansen.no)
   * @license BSD
   *
   * Copyright (c) 2010-2013 Christian Johansen
   */
  "use strict";
  
  (function (sinon) {
      function makeApi(sinon) {
          var slice = Array.prototype.slice;
  
          function test(callback) {
              var type = typeof callback;
  
              if (type != "function") {
                  throw new TypeError("sinon.test needs to wrap a test function, got " + type);
              }
  
              function sinonSandboxedTest() {
                  var config = sinon.getConfig(sinon.config);
                  config.injectInto = config.injectIntoThis && this || config.injectInto;
                  var sandbox = sinon.sandbox.create(config);
                  var args = slice.call(arguments);
                  var oldDone = args.length && args[args.length - 1];
                  var exception, result;
  
                  if (typeof oldDone == "function") {
                      args[args.length - 1] = function sinonDone(result) {
                          if (result) {
                              sandbox.restore();
                              throw exception;
                          } else {
                              sandbox.verifyAndRestore();
                          }
                          oldDone(result);
                      };
                  }
  
                  try {
                      result = callback.apply(this, args.concat(sandbox.args));
                  } catch (e) {
                      exception = e;
                  }
  
                  if (typeof oldDone != "function") {
                      if (typeof exception !== "undefined") {
                          sandbox.restore();
                          throw exception;
                      } else {
                          sandbox.verifyAndRestore();
                      }
                  }
  
                  return result;
              }
  
              if (callback.length) {
                  return function sinonAsyncSandboxedTest(callback) {
                      return sinonSandboxedTest.apply(this, arguments);
                  };
              }
  
              return sinonSandboxedTest;
          }
  
          test.config = {
              injectIntoThis: true,
              injectInto: null,
              properties: ["spy", "stub", "mock", "clock", "server", "requests"],
              useFakeTimers: true,
              useFakeServer: true
          };
  
          sinon.test = test;
          return test;
      }
  
      var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
      var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
  
      function loadDependencies(require, exports, module) {
          var sinon = require("./util/core");
          require("./sandbox");
          module.exports = makeApi(sinon);
      }
  
      if (isAMD) {
          define(loadDependencies);
      } else if (isNode) {
          loadDependencies(require, module.exports, module);
      } else if (sinon) {
          makeApi(sinon);
      }
  }(typeof sinon == "object" && sinon || null));
  