[
  {
    "path": ".gitignore",
    "content": "alameda.min.js\nalameda.min.js.gz\ncopy-to-prim.sh\nrequire.js\ntestBaseUrl.js\ntests-requirejs\n"
  },
  {
    "path": ".npmignore",
    "content": "LICENSE\nalameda.min.js\nalameda.min.js.gz\ncopyrequirejstests.sh\ncopy-to-prim.sh\nrequire.js\nshrinktest.sh\ntestBaseUrl.js\ntests\ntests-requirejs\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright jQuery Foundation and other contributors, https://jquery.org/\n\nThis software consists of voluntary contributions made by many\nindividuals. For exact contribution history, see the revision history\navailable at https://github.com/requirejs/alameda\n\nThe following license applies to all parts of this software except as\ndocumented below:\n\n====\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n====\n\nCopyright and related rights for sample code are waived via CC0. Sample\ncode is defined as all source code displayed within the prose of the\ndocumentation.\n\nCC0: http://creativecommons.org/publicdomain/zero/1.0/\n\n====\n\nFiles located in the node_modules directory, and certain utilities used\nto build or test the software in the tests and tests-requirejs directories, are\nexternally maintained libraries used by this software which have their own\nlicenses; we recommend you read them, as their terms may differ from the\nterms above.\n"
  },
  {
    "path": "README.md",
    "content": "# alameda\n\nAn AMD loader, like [requirejs](http://requirejs.org), but with the following\nimplementation changes:\n\n* Assumes Promises are available in the JS environment.\n* Targets \"modern\" web browsers that implement standardized script.onload behavior: execute load listener right after script execution, something IE9 and below did not do.\n* Assumes browser support for Array.isArray, array extras, ES5 features.\n* Does not support a couple of less-used APIs (see tests section below).\n\nThese changes means alameda is around 35% smaller than requirejs, 4.1 KB vs 6.4 KB, minified+gzipped sizes.\n\nBrowser support: browsers that [natively provide Promises](http://caniuse.com/#feat=promises). If you need to support IE 10 and 11, the [alameda-prim](https://github.com/requirejs/alameda-prim) project includes a private promise shim.\n\nYou can continue to use requirejs and the r.js optimizer for other scenarios.\nThe r.js optimizer works well with alameda-based projects.\n\n## Install\n\n[Latest release information](https://github.com/requirejs/alameda/releases)\n\nIf using a package manager:\n\n```\nnpm install alameda\n\n# or\n\n[npm | bower | volo] install requirejs/alameda\n```\n\n## API\n\nalameda supports [the requirejs API](http://requirejs.org/docs/api.html). It even\ndeclares `requirejs`, to make passing the requirejs tests easier. alameda also\nhas a good chance of becoming requirejs in a far-future requirejs version.\n\nThere are some differences with requirejs though:\n\n### require promise\n\n`require([])` will return a promise. The success callback passed to `require([])` should return a value if you want a value to be passed to the next .then() in the promise chain.\n\n```javascript\nrequire(['a', 'b'], function(a, b) {\n  // succes callback. Return a value for the next part in the promise chain.\n  return [a, b];\n}).then(function(mods) {\n  //mods[0] is the 'a' module, mods[1] is the 'b' module in this case.\n});\n```\n\n### config.defaultErrback\n\nIn requirejs and alameda, with this sort of call, the errback will be called if there is an error in either loading `['a', 'b']` or if the success callback throws an error.\n\n```javascript\nrequire(['a', 'b'], function(a, b) {\n  // success callback\n}, function(err) {\n  // errback, called if 'a', 'b' do not load, or\n  // if the success callback is called.\n});\n```\n\nSo, the errback operates like:\n\n```javascript\nrequire([], function() {}).catch(function(err) {})`;\n````\n\nIf you do not pass an errback into the require() call, and instead use a .then() or .catch() to deal with the error, you still may see the error surface outside. This is done because browsers do not all show unhandled errors in a promise chain, and the require() call itself does not know if an error handler was chained on the end, so it generates an error to make debugging and development easier.\n\nHowever, if you are properly chaining error handlers but do not pass an errback as the third arg to the require([]) call, then you can turn off this extra error surfacing by doing:\n\n```javascript\nrequirejs.config({\n  defaultErrback: null\n});\n```\n\nIf you pass a function for the `defaultErrback` value, then that will be used instead of the default \"delayedError\" handler used by alameda to surface the error.\n\n## onError is context-specific\n\nWhen using contexts, in requirejs, all top level errors would bubble up to requirejs.onError, but in alameda, the context's onError is called instead. Example:\n\n```javascript\nvar fooReq = requirejs.config({ context: 'foo' });\nrequirejs.onError = function () { console.log('requirejs.onError'); };\nfooReq.onError = function () { console.log('fooReq.onError'); };\n\nfooReq(['nonexistent']);\n\n// In alameda, fooReq.onError() is called, in requirejs, requirejs.onError is called.\n```\n\n## onResourceLoad\n\nrequirejs supports a hook into its internals, [onResourceLoad](https://github.com/requirejs/requirejs/wiki/Internal-API:-onResourceLoad). alameda supports an onResourceLoad function too, but the arguments passed to the function are objects that have different property names than the ones in requirejs.\n\nThis is the general signature, which is the same between alameda and requirejs:\n\n```javascript\nalameda.onResourceLoad = function (context, map, depArray) {};\n```\n\nThe differences between property names in the different argument objects is described below. See the [onResourceLoad page](https://github.com/requirejs/requirejs/wiki/Internal-API:-onResourceLoad) for the description of the arguments.\n\n### context\n\n| alameda | requirejs |\n| ------- | --------- |\n| `id` | `contextName` |\n\n### map\n\n| alameda | requirejs |\n| ------- | --------- |\n| `pr` | `prefix` |\n| `n` | `name` |\n| n/a | `parentMap` |\n| `url` | `url` |\n| n/a | `originalName` |\n| `id` | `fullName` |\n\n### depArray\n\nAn array of `map` objects with the same properties as the `map` listing above.\n\n## License\n\nMIT\n\n## Code of Conduct\n\n[jQuery Foundation Code of Conduct](https://jquery.org/conduct/).\n\n## Running tests\n\nThe tests are pulled from almond and requirejs. All tests should be served\nthrough a local web server, as the text loader plugin is used for some tests,\nand some browsers restrict local XHR usage when the files are served from\na `file://` URL.\n\n### Bundled tests\n\nTo run the tests that are just part of this repo, open `tests/index.html` in\na web browser.\n\n### requirejs tests\n\nTo run the requirejs tests, first make sure the following projects have been cloned and are **siblings** to the the alameda repo:\n\n* https://github.com/requirejs/requirejs\n* https://github.com/requirejs/domReady\n* https://github.com/requirejs/text\n* https://github.com/requirejs/i18n\n\nThen do the following:\n\n* symlink alameda.js to require.js\n* ./copyrequirejstests.sh\n\n#### requirejs tests that do not pass\n\n* require.undef()-related tests.\n* onResourceLoadNestedRequire: depends on implementing requirejs.onResourceLoad\nhook used for builds/some third party tools. This API is not required for normal\nmodule loading.\n\n## How to get help\n\n* Open issues in the [issue tracker](https://github.com/requirejs/alameda/issues).\n* Contact the [requirejs list](https://groups.google.com/group/requirejs).\n"
  },
  {
    "path": "alameda.js",
    "content": "/**\n * @license alameda 1.4.0 Copyright jQuery Foundation and other contributors.\n * Released under MIT license, https://github.com/requirejs/alameda/blob/master/LICENSE\n */\n// Going sloppy because loader plugin execs may depend on non-strict execution.\n/*jslint sloppy: true, nomen: true, regexp: true */\n/*global document, navigator, importScripts, Promise, setTimeout */\n\nvar requirejs, require, define;\n(function (global, Promise, undef) {\n  if (!Promise) {\n    throw new Error('No Promise implementation available');\n  }\n\n  var topReq, dataMain, src, subPath,\n    bootstrapConfig = requirejs || require,\n    hasOwn = Object.prototype.hasOwnProperty,\n    contexts = {},\n    queue = [],\n    currDirRegExp = /^\\.\\//,\n    urlRegExp = /^\\/|\\:|\\?|\\.js$/,\n    commentRegExp = /\\/\\*[\\s\\S]*?\\*\\/|([^:\"'=]|^)\\/\\/.*$/mg,\n    cjsRequireRegExp = /[^.]\\s*require\\s*\\(\\s*[\"']([^'\"\\s]+)[\"']\\s*\\)/g,\n    jsSuffixRegExp = /\\.js$/,\n    slice = Array.prototype.slice;\n\n  if (typeof requirejs === 'function') {\n    return;\n  }\n\n  var asap = Promise.resolve(undefined);\n\n  // Could match something like ')//comment', do not lose the prefix to comment.\n  function commentReplace(match, singlePrefix) {\n    return singlePrefix || '';\n  }\n\n  function hasProp(obj, prop) {\n    return hasOwn.call(obj, prop);\n  }\n\n  function getOwn(obj, prop) {\n    return obj && hasProp(obj, prop) && obj[prop];\n  }\n\n  function obj() {\n    return Object.create(null);\n  }\n\n  /**\n   * Cycles over properties in an object and calls a function for each\n   * property value. If the function returns a truthy value, then the\n   * iteration is stopped.\n   */\n  function eachProp(obj, func) {\n    var prop;\n    for (prop in obj) {\n      if (hasProp(obj, prop)) {\n        if (func(obj[prop], prop)) {\n          break;\n        }\n      }\n    }\n  }\n\n  /**\n   * Simple function to mix in properties from source into target,\n   * but only if target does not already have a property of the same name.\n   */\n  function mixin(target, source, force, deepStringMixin) {\n    if (source) {\n      eachProp(source, function (value, prop) {\n        if (force || !hasProp(target, prop)) {\n          if (deepStringMixin && typeof value === 'object' && value &&\n            !Array.isArray(value) && typeof value !== 'function' &&\n            !(value instanceof RegExp)) {\n\n            if (!target[prop]) {\n              target[prop] = {};\n            }\n            mixin(target[prop], value, force, deepStringMixin);\n          } else {\n            target[prop] = value;\n          }\n        }\n      });\n    }\n    return target;\n  }\n\n  // Allow getting a global that expressed in\n  // dot notation, like 'a.b.c'.\n  function getGlobal(value) {\n    if (!value) {\n      return value;\n    }\n    var g = global;\n    value.split('.').forEach(function (part) {\n      g = g[part];\n    });\n    return g;\n  }\n\n  function newContext(contextName) {\n    var req, main, makeMap, callDep, handlers, checkingLater, load, context,\n      defined = obj(),\n      waiting = obj(),\n      config = {\n        // Defaults. Do not set a default for map\n        // config to speed up normalize(), which\n        // will run faster if there is no default.\n        waitSeconds: 7,\n        baseUrl: './',\n        paths: {},\n        bundles: {},\n        pkgs: {},\n        shim: {},\n        config: {}\n      },\n      mapCache = obj(),\n      requireDeferreds = [],\n      deferreds = obj(),\n      calledDefine = obj(),\n      calledPlugin = obj(),\n      loadCount = 0,\n      startTime = (new Date()).getTime(),\n      errCount = 0,\n      trackedErrors = obj(),\n      urlFetched = obj(),\n      bundlesMap = obj(),\n      asyncResolve = Promise.resolve();\n\n    /**\n     * Trims the . and .. from an array of path segments.\n     * It will keep a leading path segment if a .. will become\n     * the first path segment, to help with module name lookups,\n     * which act like paths, but can be remapped. But the end result,\n     * all paths that use this function should look normalized.\n     * NOTE: this method MODIFIES the input array.\n     * @param {Array} ary the array of path segments.\n     */\n    function trimDots(ary) {\n      var i, part, length = ary.length;\n      for (i = 0; i < length; i++) {\n        part = ary[i];\n        if (part === '.') {\n          ary.splice(i, 1);\n          i -= 1;\n        } else if (part === '..') {\n          // If at the start, or previous value is still ..,\n          // keep them so that when converted to a path it may\n          // still work when converted to a path, even though\n          // as an ID it is less than ideal. In larger point\n          // releases, may be better to just kick out an error.\n          if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {\n            continue;\n          } else if (i > 0) {\n            ary.splice(i - 1, 2);\n            i -= 2;\n          }\n        }\n      }\n    }\n\n    /**\n     * Given a relative module name, like ./something, normalize it to\n     * a real name that can be mapped to a path.\n     * @param {String} name the relative name\n     * @param {String} baseName a real name that the name arg is relative\n     * to.\n     * @param {Boolean} applyMap apply the map config to the value. Should\n     * only be done if this normalization is for a dependency ID.\n     * @returns {String} normalized name\n     */\n    function normalize(name, baseName, applyMap) {\n      var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,\n        foundMap, foundI, foundStarMap, starI,\n        baseParts = baseName && baseName.split('/'),\n        normalizedBaseParts = baseParts,\n        map = config.map,\n        starMap = map && map['*'];\n\n\n      //Adjust any relative paths.\n      if (name) {\n        name = name.split('/');\n        lastIndex = name.length - 1;\n\n        // If wanting node ID compatibility, strip .js from end\n        // of IDs. Have to do this here, and not in nameToUrl\n        // because node allows either .js or non .js to map\n        // to same file.\n        if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {\n          name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');\n        }\n\n        // Starts with a '.' so need the baseName\n        if (name[0].charAt(0) === '.' && baseParts) {\n          //Convert baseName to array, and lop off the last part,\n          //so that . matches that 'directory' and not name of the baseName's\n          //module. For instance, baseName of 'one/two/three', maps to\n          //'one/two/three.js', but we want the directory, 'one/two' for\n          //this normalization.\n          normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);\n          name = normalizedBaseParts.concat(name);\n        }\n\n        trimDots(name);\n        name = name.join('/');\n      }\n\n      // Apply map config if available.\n      if (applyMap && map && (baseParts || starMap)) {\n        nameParts = name.split('/');\n\n        outerLoop: for (i = nameParts.length; i > 0; i -= 1) {\n          nameSegment = nameParts.slice(0, i).join('/');\n\n          if (baseParts) {\n            // Find the longest baseName segment match in the config.\n            // So, do joins on the biggest to smallest lengths of baseParts.\n            for (j = baseParts.length; j > 0; j -= 1) {\n              mapValue = getOwn(map, baseParts.slice(0, j).join('/'));\n\n              // baseName segment has config, find if it has one for\n              // this name.\n              if (mapValue) {\n                mapValue = getOwn(mapValue, nameSegment);\n                if (mapValue) {\n                  // Match, update name to the new value.\n                  foundMap = mapValue;\n                  foundI = i;\n                  break outerLoop;\n                }\n              }\n            }\n          }\n\n          // Check for a star map match, but just hold on to it,\n          // if there is a shorter segment match later in a matching\n          // config, then favor over this star map.\n          if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {\n            foundStarMap = getOwn(starMap, nameSegment);\n            starI = i;\n          }\n        }\n\n        if (!foundMap && foundStarMap) {\n          foundMap = foundStarMap;\n          foundI = starI;\n        }\n\n        if (foundMap) {\n          nameParts.splice(0, foundI, foundMap);\n          name = nameParts.join('/');\n        }\n      }\n\n      // If the name points to a package's name, use\n      // the package main instead.\n      pkgMain = getOwn(config.pkgs, name);\n\n      return pkgMain ? pkgMain : name;\n    }\n\n    function makeShimExports(value) {\n      function fn() {\n        var ret;\n        if (value.init) {\n          ret = value.init.apply(global, arguments);\n        }\n        return ret || (value.exports && getGlobal(value.exports));\n      }\n      return fn;\n    }\n\n    function takeQueue(anonId) {\n      var i, id, args, shim;\n      for (i = 0; i < queue.length; i += 1) {\n        // Peek to see if anon\n        if (typeof queue[i][0] !== 'string') {\n          if (anonId) {\n            queue[i].unshift(anonId);\n            anonId = undef;\n          } else {\n            // Not our anon module, stop.\n            break;\n          }\n        }\n        args = queue.shift();\n        id = args[0];\n        i -= 1;\n\n        if (!(id in defined) && !(id in waiting)) {\n          if (id in deferreds) {\n            main.apply(undef, args);\n          } else {\n            waiting[id] = args;\n          }\n        }\n      }\n\n      // if get to the end and still have anonId, then could be\n      // a shimmed dependency.\n      if (anonId) {\n        shim = getOwn(config.shim, anonId) || {};\n        main(anonId, shim.deps || [], shim.exportsFn);\n      }\n    }\n\n    function makeRequire(relName, topLevel) {\n      var req = function (deps, callback, errback, alt) {\n        var name, cfg;\n\n        if (topLevel) {\n          takeQueue();\n        }\n\n        if (typeof deps === \"string\") {\n          if (handlers[deps]) {\n            return handlers[deps](relName);\n          }\n          // Just return the module wanted. In this scenario, the\n          // deps arg is the module name, and second arg (if passed)\n          // is just the relName.\n          // Normalize module name, if it contains . or ..\n          name = makeMap(deps, relName, true).id;\n          if (!(name in defined)) {\n            throw new Error('Not loaded: ' + name);\n          }\n          return defined[name];\n        } else if (deps && !Array.isArray(deps)) {\n          // deps is a config object, not an array.\n          cfg = deps;\n          deps = undef;\n\n          if (Array.isArray(callback)) {\n            // callback is an array, which means it is a dependency list.\n            // Adjust args if there are dependencies\n            deps = callback;\n            callback = errback;\n            errback = alt;\n          }\n\n          if (topLevel) {\n            // Could be a new context, so call returned require\n            return req.config(cfg)(deps, callback, errback);\n          }\n        }\n\n        // Support require(['a'])\n        callback = callback || function () {\n          // In case used later as a promise then value, return the\n          // arguments as an array.\n          return slice.call(arguments, 0);\n        };\n\n        // Complete async to maintain expected execution semantics.\n        return asyncResolve.then(function () {\n          // Grab any modules that were defined after a require call.\n          takeQueue();\n\n          return main(undef, deps || [], callback, errback, relName);\n        });\n      };\n\n      req.isBrowser = typeof document !== 'undefined' &&\n        typeof navigator !== 'undefined';\n\n      req.nameToUrl = function (moduleName, ext, skipExt) {\n        var paths, syms, i, parentModule, url,\n          parentPath, bundleId,\n          pkgMain = getOwn(config.pkgs, moduleName);\n\n        if (pkgMain) {\n          moduleName = pkgMain;\n        }\n\n        bundleId = getOwn(bundlesMap, moduleName);\n\n        if (bundleId) {\n          return req.nameToUrl(bundleId, ext, skipExt);\n        }\n\n        // If a colon is in the URL, it indicates a protocol is used and it is\n        // just an URL to a file, or if it starts with a slash, contains a query\n        // arg (i.e. ?) or ends with .js, then assume the user meant to use an\n        // url and not a module id. The slash is important for protocol-less\n        // URLs as well as full paths.\n        if (urlRegExp.test(moduleName)) {\n          // Just a plain path, not module name lookup, so just return it.\n          // Add extension if it is included. This is a bit wonky, only non-.js\n          // things pass an extension, this method probably needs to be\n          // reworked.\n          url = moduleName + (ext || '');\n        } else {\n          // A module that needs to be converted to a path.\n          paths = config.paths;\n\n          syms = moduleName.split('/');\n          // For each module name segment, see if there is a path\n          // registered for it. Start with most specific name\n          // and work up from it.\n          for (i = syms.length; i > 0; i -= 1) {\n            parentModule = syms.slice(0, i).join('/');\n\n            parentPath = getOwn(paths, parentModule);\n            if (parentPath) {\n              // If an array, it means there are a few choices,\n              // Choose the one that is desired\n              if (Array.isArray(parentPath)) {\n                parentPath = parentPath[0];\n              }\n              syms.splice(0, i, parentPath);\n              break;\n            }\n          }\n\n          // Join the path parts together, then figure out if baseUrl is needed.\n          url = syms.join('/');\n          url += (ext || (/^data\\:|^blob\\:|\\?/.test(url) || skipExt ? '' : '.js'));\n          url = (url.charAt(0) === '/' ||\n                url.match(/^[\\w\\+\\.\\-]+:/) ? '' : config.baseUrl) + url;\n        }\n\n        return config.urlArgs && !/^blob\\:/.test(url) ?\n               url + config.urlArgs(moduleName, url) : url;\n      };\n\n      /**\n       * Converts a module name + .extension into an URL path.\n       * *Requires* the use of a module name. It does not support using\n       * plain URLs like nameToUrl.\n       */\n      req.toUrl = function (moduleNamePlusExt) {\n        var ext,\n          index = moduleNamePlusExt.lastIndexOf('.'),\n          segment = moduleNamePlusExt.split('/')[0],\n          isRelative = segment === '.' || segment === '..';\n\n        // Have a file extension alias, and it is not the\n        // dots from a relative path.\n        if (index !== -1 && (!isRelative || index > 1)) {\n          ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);\n          moduleNamePlusExt = moduleNamePlusExt.substring(0, index);\n        }\n\n        return req.nameToUrl(normalize(moduleNamePlusExt, relName), ext, true);\n      };\n\n      req.defined = function (id) {\n        return makeMap(id, relName, true).id in defined;\n      };\n\n      req.specified = function (id) {\n        id = makeMap(id, relName, true).id;\n        return id in defined || id in deferreds;\n      };\n\n      return req;\n    }\n\n    function resolve(name, d, value) {\n      if (name) {\n        defined[name] = value;\n        if (requirejs.onResourceLoad) {\n          requirejs.onResourceLoad(context, d.map, d.deps);\n        }\n      }\n      d.finished = true;\n      d.resolve(value);\n    }\n\n    function reject(d, err) {\n      d.finished = true;\n      d.rejected = true;\n      d.reject(err);\n    }\n\n    function makeNormalize(relName) {\n      return function (name) {\n        return normalize(name, relName, true);\n      };\n    }\n\n    function defineModule(d) {\n      d.factoryCalled = true;\n\n      var ret,\n        name = d.map.id;\n\n      try {\n        ret = context.execCb(name, d.factory, d.values, defined[name]);\n      } catch(err) {\n        return reject(d, err);\n      }\n\n      if (name) {\n        // Favor return value over exports. If node/cjs in play,\n        // then will not have a return value anyway. Favor\n        // module.exports assignment over exports object.\n        if (ret === undef) {\n          if (d.cjsModule) {\n            ret = d.cjsModule.exports;\n          } else if (d.usingExports) {\n            ret = defined[name];\n          }\n        }\n      } else {\n        // Remove the require deferred from the list to\n        // make cycle searching faster. Do not need to track\n        // it anymore either.\n        requireDeferreds.splice(requireDeferreds.indexOf(d), 1);\n      }\n      resolve(name, d, ret);\n    }\n\n    // This method is attached to every module deferred,\n    // so the \"this\" in here is the module deferred object.\n    function depFinished(val, i) {\n      if (!this.rejected && !this.depDefined[i]) {\n        this.depDefined[i] = true;\n        this.depCount += 1;\n        this.values[i] = val;\n        if (!this.depending && this.depCount === this.depMax) {\n          defineModule(this);\n        }\n      }\n    }\n\n    function makeDefer(name, calculatedMap) {\n      var d = {};\n      d.promise = new Promise(function (resolve, reject) {\n        d.resolve = resolve;\n        d.reject = function(err) {\n          if (!name) {\n            requireDeferreds.splice(requireDeferreds.indexOf(d), 1);\n          }\n          reject(err);\n        };\n      });\n      d.map = name ? (calculatedMap || makeMap(name)) : {};\n      d.depCount = 0;\n      d.depMax = 0;\n      d.values = [];\n      d.depDefined = [];\n      d.depFinished = depFinished;\n      if (d.map.pr) {\n        // Plugin resource ID, implicitly\n        // depends on plugin. Track it in deps\n        // so cycle breaking can work\n        d.deps = [makeMap(d.map.pr)];\n      }\n      return d;\n    }\n\n    function getDefer(name, calculatedMap) {\n      var d;\n      if (name) {\n        d = (name in deferreds) && deferreds[name];\n        if (!d) {\n          d = deferreds[name] = makeDefer(name, calculatedMap);\n        }\n      } else {\n        d = makeDefer();\n        requireDeferreds.push(d);\n      }\n      return d;\n    }\n\n    function makeErrback(d, name) {\n      return function (err) {\n        if (!d.rejected) {\n          if (!err.dynaId) {\n            err.dynaId = 'id' + (errCount += 1);\n            err.requireModules = [name];\n          }\n          reject(d, err);\n        }\n      };\n    }\n\n    function waitForDep(depMap, relName, d, i) {\n      d.depMax += 1;\n\n      // Do the fail at the end to catch errors\n      // in the then callback execution.\n      callDep(depMap, relName).then(function (val) {\n        d.depFinished(val, i);\n      }, makeErrback(d, depMap.id)).catch(makeErrback(d, d.map.id));\n    }\n\n    function makeLoad(id) {\n      var fromTextCalled;\n      function load(value) {\n        // Protect against older plugins that call load after\n        // calling load.fromText\n        if (!fromTextCalled) {\n          resolve(id, getDefer(id), value);\n        }\n      }\n\n      load.error = function (err) {\n        reject(getDefer(id), err);\n      };\n\n      load.fromText = function (text, textAlt) {\n        /*jslint evil: true */\n        var d = getDefer(id),\n          map = makeMap(makeMap(id).n),\n          plainId = map.id,\n          execError;\n\n        fromTextCalled = true;\n\n        // Set up the factory just to be a return of the value from\n        // plainId.\n        d.factory = function (p, val) {\n          return val;\n        };\n\n        // As of requirejs 2.1.0, support just passing the text, to reinforce\n        // fromText only being called once per resource. Still\n        // support old style of passing moduleName but discard\n        // that moduleName in favor of the internal ref.\n        if (textAlt) {\n          text = textAlt;\n        }\n\n        // Transfer any config to this other module.\n        if (hasProp(config.config, id)) {\n          config.config[plainId] = config.config[id];\n        }\n\n        try {\n          req.exec(text);\n        } catch (e) {\n          execError = new Error('fromText eval for ' + plainId +\n                                ' failed: ' + e);\n          execError.requireType = 'fromtexteval';\n          reject(d, execError);\n        }\n\n        // Execute any waiting define created by the plainId\n        takeQueue(plainId);\n\n        // Mark this as a dependency for the plugin\n        // resource\n        d.deps = [map];\n        waitForDep(map, null, d, d.deps.length);\n      };\n\n      return load;\n    }\n\n    load = typeof importScripts === 'function' ?\n        function (map) {\n          var url = map.url;\n          if (urlFetched[url]) {\n            return;\n          }\n          urlFetched[url] = true;\n\n          // Ask for the deferred so loading is triggered.\n          // Do this before loading, since loading is sync.\n          getDefer(map.id);\n          importScripts(url);\n          takeQueue(map.id);\n        } :\n        function (map) {\n          var script,\n            id = map.id,\n            url = map.url;\n\n          if (urlFetched[url]) {\n            return;\n          }\n          urlFetched[url] = true;\n\n          script = document.createElement('script');\n          script.setAttribute('data-requiremodule', id);\n          script.type = config.scriptType || 'text/javascript';\n          script.charset = 'utf-8';\n          script.async = true;\n\n          loadCount += 1;\n\n          script.addEventListener('load', function () {\n            loadCount -= 1;\n            takeQueue(id);\n          }, false);\n          script.addEventListener('error', function () {\n            loadCount -= 1;\n            var err,\n              pathConfig = getOwn(config.paths, id);\n            if (pathConfig && Array.isArray(pathConfig) &&\n                pathConfig.length > 1) {\n              script.parentNode.removeChild(script);\n              // Pop off the first array value, since it failed, and\n              // retry\n              pathConfig.shift();\n              var d = getDefer(id);\n              d.map = makeMap(id);\n              // mapCache will have returned previous map value, update the\n              // url, which will also update mapCache value.\n              d.map.url = req.nameToUrl(id);\n              load(d.map);\n            } else {\n              err = new Error('Load failed: ' + id + ': ' + script.src);\n              err.requireModules = [id];\n              err.requireType = 'scripterror';\n              reject(getDefer(id), err);\n            }\n          }, false);\n\n          script.src = url;\n\n          if (config.onNodeCreated) {\n            config.onNodeCreated(script, config, id, url);\n          }\n\n          // If the script is cached, IE10 executes the script body and the\n          // onload handler synchronously here.  That's a spec violation,\n          // so be sure to do this asynchronously.\n          if (document.documentMode === 10) {\n            asap.then(function() {\n              document.head.appendChild(script);\n            });\n          } else {\n            document.head.appendChild(script);\n          }\n        };\n\n    function callPlugin(plugin, map, relName) {\n      plugin.load(map.n, makeRequire(relName), makeLoad(map.id), config);\n    }\n\n    callDep = function (map, relName) {\n      var args, bundleId,\n        name = map.id,\n        shim = config.shim[name];\n\n      if (name in waiting) {\n        args = waiting[name];\n        delete waiting[name];\n        main.apply(undef, args);\n      } else if (!(name in deferreds)) {\n        if (map.pr) {\n          // If a bundles config, then just load that file instead to\n          // resolve the plugin, as it is built into that bundle.\n          if ((bundleId = getOwn(bundlesMap, name))) {\n            map.url = req.nameToUrl(bundleId);\n            load(map);\n          } else {\n            return callDep(makeMap(map.pr)).then(function (plugin) {\n              // Redo map now that plugin is known to be loaded\n              var newMap = map.prn ? map : makeMap(name, relName, true),\n                newId = newMap.id,\n                shim = getOwn(config.shim, newId);\n\n              // Make sure to only call load once per resource. Many\n              // calls could have been queued waiting for plugin to load.\n              if (!(newId in calledPlugin)) {\n                calledPlugin[newId] = true;\n                if (shim && shim.deps) {\n                  req(shim.deps, function () {\n                    callPlugin(plugin, newMap, relName);\n                  });\n                } else {\n                  callPlugin(plugin, newMap, relName);\n                }\n              }\n              return getDefer(newId).promise;\n            });\n          }\n        } else if (shim && shim.deps) {\n          req(shim.deps, function () {\n            load(map);\n          });\n        } else {\n          load(map);\n        }\n      }\n\n      return getDefer(name).promise;\n    };\n\n    // Turns a plugin!resource to [plugin, resource]\n    // with the plugin being undefined if the name\n    // did not have a plugin prefix.\n    function splitPrefix(name) {\n      var prefix,\n        index = name ? name.indexOf('!') : -1;\n      if (index > -1) {\n        prefix = name.substring(0, index);\n        name = name.substring(index + 1, name.length);\n      }\n      return [prefix, name];\n    }\n\n    /**\n     * Makes a name map, normalizing the name, and using a plugin\n     * for normalization if necessary. Grabs a ref to plugin\n     * too, as an optimization.\n     */\n    makeMap = function (name, relName, applyMap) {\n      if (typeof name !== 'string') {\n        return name;\n      }\n\n      var plugin, url, parts, prefix, result, prefixNormalized,\n        cacheKey = name + ' & ' + (relName || '') + ' & ' + !!applyMap;\n\n      parts = splitPrefix(name);\n      prefix = parts[0];\n      name = parts[1];\n\n      if (!prefix && (cacheKey in mapCache)) {\n        return mapCache[cacheKey];\n      }\n\n      if (prefix) {\n        prefix = normalize(prefix, relName, applyMap);\n        plugin = (prefix in defined) && defined[prefix];\n      }\n\n      // Normalize according\n      if (prefix) {\n        if (plugin && plugin.normalize) {\n          name = plugin.normalize(name, makeNormalize(relName));\n          prefixNormalized = true;\n        } else {\n          // If nested plugin references, then do not try to\n          // normalize, as it will not normalize correctly. This\n          // places a restriction on resourceIds, and the longer\n          // term solution is not to normalize until plugins are\n          // loaded and all normalizations to allow for async\n          // loading of a loader plugin. But for now, fixes the\n          // common uses. Details in requirejs#1131\n          name = name.indexOf('!') === -1 ?\n                   normalize(name, relName, applyMap) :\n                   name;\n        }\n      } else {\n        name = normalize(name, relName, applyMap);\n        parts = splitPrefix(name);\n        prefix = parts[0];\n        name = parts[1];\n\n        url = req.nameToUrl(name);\n      }\n\n      // Using ridiculous property names for space reasons\n      result = {\n        id: prefix ? prefix + '!' + name : name, // fullName\n        n: name,\n        pr: prefix,\n        url: url,\n        prn: prefix && prefixNormalized\n      };\n\n      if (!prefix) {\n        mapCache[cacheKey] = result;\n      }\n\n      return result;\n    };\n\n    handlers = {\n      require: function (name) {\n        return makeRequire(name);\n      },\n      exports: function (name) {\n        var e = defined[name];\n        if (typeof e !== 'undefined') {\n          return e;\n        } else {\n          return (defined[name] = {});\n        }\n      },\n      module: function (name, url) {\n        return {\n          id: name,\n          uri: url || '',\n          exports: handlers.exports(name),\n          config: function () {\n            return getOwn(config.config, name) || {};\n          }\n        };\n      }\n    };\n\n    function breakCycle(d, traced, processed) {\n      var id = d.map.id;\n\n      traced[id] = true;\n      if (!d.finished && d.deps) {\n        d.deps.forEach(function (depMap) {\n          var depId = depMap.id,\n            dep = !hasProp(handlers, depId) && getDefer(depId, depMap);\n\n          // Only force things that have not completed\n          // being defined, so still in the registry,\n          // and only if it has not been matched up\n          // in the module already.\n          if (dep && !dep.finished && !processed[depId]) {\n            if (hasProp(traced, depId)) {\n              d.deps.forEach(function (depMap, i) {\n                if (depMap.id === depId) {\n                  d.depFinished(defined[depId], i);\n                }\n              });\n            } else {\n              breakCycle(dep, traced, processed);\n            }\n          }\n        });\n      }\n      processed[id] = true;\n    }\n\n    function check(d) {\n      var err, mid, dfd,\n        notFinished = [],\n        waitInterval = config.waitSeconds * 1000,\n        // It is possible to disable the wait interval by using waitSeconds 0.\n        expired = waitInterval &&\n                  (startTime + waitInterval) < (new Date()).getTime();\n\n    if (loadCount === 0) {\n        // If passed in a deferred, it is for a specific require call.\n        // Could be a sync case that needs resolution right away.\n        // Otherwise, if no deferred, means it was the last ditch\n        // timeout-based check, so check all waiting require deferreds.\n        if (d) {\n          if (!d.finished) {\n            breakCycle(d, {}, {});\n          }\n        } else if (requireDeferreds.length) {\n          requireDeferreds.forEach(function (d) {\n            breakCycle(d, {}, {});\n          });\n        }\n      }\n\n      // If still waiting on loads, and the waiting load is something\n      // other than a plugin resource, or there are still outstanding\n      // scripts, then just try back later.\n      if (expired) {\n        // If wait time expired, throw error of unloaded modules.\n        for (mid in deferreds) {\n          dfd = deferreds[mid];\n          if (!dfd.finished) {\n            notFinished.push(dfd.map.id);\n          }\n        }\n        err = new Error('Timeout for modules: ' + notFinished);\n        err.requireModules = notFinished;\n        err.requireType = 'timeout';\n        notFinished.forEach(function (id) {\n          reject(getDefer(id), err);\n        });\n      } else if (loadCount || requireDeferreds.length) {\n        // Something is still waiting to load. Wait for it, but only\n        // if a later check is not already scheduled. Using setTimeout\n        // because want other things in the event loop to happen,\n        // to help in dependency resolution, and this is really a\n        // last ditch check, mostly for detecting timeouts (cycles\n        // should come through the main() use of check()), so it can\n        // wait a bit before doing the final check.\n        if (!checkingLater) {\n          checkingLater = true;\n          setTimeout(function () {\n            checkingLater = false;\n            check();\n          }, 70);\n        }\n      }\n    }\n\n    // Used to break out of the promise try/catch chains.\n    function delayedError(e) {\n      setTimeout(function () {\n        if (!e.dynaId || !trackedErrors[e.dynaId]) {\n          trackedErrors[e.dynaId] = true;\n          req.onError(e);\n        }\n      });\n      return e;\n    }\n\n    main = function (name, deps, factory, errback, relName) {\n      if (name) {\n        // Only allow main calling once per module.\n        if (name in calledDefine) {\n          return;\n        }\n        calledDefine[name] = true;\n      }\n\n      var d = getDefer(name);\n\n      // This module may not have dependencies\n      if (deps && !Array.isArray(deps)) {\n        // deps is not an array, so probably means\n        // an object literal or factory function for\n        // the value. Adjust args.\n        factory = deps;\n        deps = [];\n      }\n\n      // Create fresh array instead of modifying passed in value.\n      deps = deps ? slice.call(deps, 0) : null;\n\n      if (!errback) {\n        if (hasProp(config, 'defaultErrback')) {\n          if (config.defaultErrback) {\n            errback = config.defaultErrback;\n          }\n        } else {\n          errback = delayedError;\n        }\n      }\n\n      if (errback) {\n         d.promise.catch(errback);\n      }\n\n      // Use name if no relName\n      relName = relName || name;\n\n      // Call the factory to define the module, if necessary.\n      if (typeof factory === 'function') {\n\n        if (!deps.length && factory.length) {\n          // Remove comments from the callback string,\n          // look for require calls, and pull them into the dependencies,\n          // but only if there are function args.\n          factory\n            .toString()\n            .replace(commentRegExp, commentReplace)\n            .replace(cjsRequireRegExp, function (match, dep) {\n              deps.push(dep);\n            });\n\n          // May be a CommonJS thing even without require calls, but still\n          // could use exports, and module. Avoid doing exports and module\n          // work though if it just needs require.\n          // REQUIRES the function to expect the CommonJS variables in the\n          // order listed below.\n          deps = (factory.length === 1 ?\n              ['require'] :\n              ['require', 'exports', 'module']).concat(deps);\n        }\n\n        // Save info for use later.\n        d.factory = factory;\n        d.deps = deps;\n\n        d.depending = true;\n        deps.forEach(function (depName, i) {\n          var depMap;\n          deps[i] = depMap = makeMap(depName, relName, true);\n          depName = depMap.id;\n\n          // Fast path CommonJS standard dependencies.\n          if (depName === \"require\") {\n            d.values[i] = handlers.require(name);\n          } else if (depName === \"exports\") {\n            // CommonJS module spec 1.1\n            d.values[i] = handlers.exports(name);\n            d.usingExports = true;\n          } else if (depName === \"module\") {\n            // CommonJS module spec 1.1\n            d.values[i] = d.cjsModule = handlers.module(name, d.map.url);\n          } else if (depName === undefined) {\n            d.values[i] = undefined;\n          } else {\n            waitForDep(depMap, relName, d, i);\n          }\n        });\n        d.depending = false;\n\n        // Some modules just depend on the require, exports, modules, so\n        // trigger their definition here if so.\n        if (d.depCount === d.depMax) {\n          defineModule(d);\n        }\n      } else if (name) {\n        // May just be an object definition for the module. Only\n        // worry about defining if have a module name.\n        resolve(name, d, factory);\n      }\n\n      startTime = (new Date()).getTime();\n\n      if (!name) {\n        check(d);\n      }\n\n      return d.promise;\n    };\n\n    req = makeRequire(null, true);\n\n    /*\n     * Just drops the config on the floor, but returns req in case\n     * the config return value is used.\n     */\n    req.config = function (cfg) {\n      if (cfg.context && cfg.context !== contextName) {\n        var existingContext = getOwn(contexts, cfg.context);\n        if (existingContext) {\n          return existingContext.req.config(cfg);\n        } else {\n          return newContext(cfg.context).config(cfg);\n        }\n      }\n\n      // Since config changed, mapCache may not be valid any more.\n      mapCache = obj();\n\n      // Make sure the baseUrl ends in a slash.\n      if (cfg.baseUrl) {\n        if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {\n          cfg.baseUrl += '/';\n        }\n      }\n\n      // Convert old style urlArgs string to a function.\n      if (typeof cfg.urlArgs === 'string') {\n        var urlArgs = cfg.urlArgs;\n        cfg.urlArgs = function(id, url) {\n          return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;\n        };\n      }\n\n      // Save off the paths and packages since they require special processing,\n      // they are additive.\n      var shim = config.shim,\n        objs = {\n          paths: true,\n          bundles: true,\n          config: true,\n          map: true\n        };\n\n      eachProp(cfg, function (value, prop) {\n        if (objs[prop]) {\n          if (!config[prop]) {\n            config[prop] = {};\n          }\n          mixin(config[prop], value, true, true);\n        } else {\n          config[prop] = value;\n        }\n      });\n\n      // Reverse map the bundles\n      if (cfg.bundles) {\n        eachProp(cfg.bundles, function (value, prop) {\n          value.forEach(function (v) {\n            if (v !== prop) {\n              bundlesMap[v] = prop;\n            }\n          });\n        });\n      }\n\n      // Merge shim\n      if (cfg.shim) {\n        eachProp(cfg.shim, function (value, id) {\n          // Normalize the structure\n          if (Array.isArray(value)) {\n            value = {\n              deps: value\n            };\n          }\n          if ((value.exports || value.init) && !value.exportsFn) {\n            value.exportsFn = makeShimExports(value);\n          }\n          shim[id] = value;\n        });\n        config.shim = shim;\n      }\n\n      // Adjust packages if necessary.\n      if (cfg.packages) {\n        cfg.packages.forEach(function (pkgObj) {\n          var location, name;\n\n          pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;\n\n          name = pkgObj.name;\n          location = pkgObj.location;\n          if (location) {\n            config.paths[name] = pkgObj.location;\n          }\n\n          // Save pointer to main module ID for pkg name.\n          // Remove leading dot in main, so main paths are normalized,\n          // and remove any trailing .js, since different package\n          // envs have different conventions: some use a module name,\n          // some use a file name.\n          config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')\n                 .replace(currDirRegExp, '')\n                 .replace(jsSuffixRegExp, '');\n        });\n      }\n\n      // If a deps array or a config callback is specified, then call\n      // require with those args. This is useful when require is defined as a\n      // config object before require.js is loaded.\n      if (cfg.deps || cfg.callback) {\n        req(cfg.deps, cfg.callback);\n      }\n\n      return req;\n    };\n\n    req.onError = function (err) {\n      throw err;\n    };\n\n    context = {\n      id: contextName,\n      defined: defined,\n      waiting: waiting,\n      config: config,\n      deferreds: deferreds,\n      req: req,\n      execCb: function execCb(name, callback, args, exports) {\n        return callback.apply(exports, args);\n      }\n    };\n\n    contexts[contextName] = context;\n\n    return req;\n  }\n\n  requirejs = topReq = newContext('_');\n\n  if (typeof require !== 'function') {\n    require = topReq;\n  }\n\n  /**\n   * Executes the text. Normally just uses eval, but can be modified\n   * to use a better, environment-specific call. Only used for transpiling\n   * loader plugins, not for plain JS modules.\n   * @param {String} text the text to execute/evaluate.\n   */\n  topReq.exec = function (text) {\n    /*jslint evil: true */\n    return eval(text);\n  };\n\n  topReq.contexts = contexts;\n\n  define = function () {\n    queue.push(slice.call(arguments, 0));\n  };\n\n  define.amd = {\n    jQuery: true\n  };\n\n  if (bootstrapConfig) {\n    topReq.config(bootstrapConfig);\n  }\n\n  // data-main support.\n  if (topReq.isBrowser && !contexts._.config.skipDataMain) {\n    dataMain = document.querySelectorAll('script[data-main]')[0];\n    dataMain = dataMain && dataMain.getAttribute('data-main');\n    if (dataMain) {\n      // Strip off any trailing .js since dataMain is now\n      // like a module name.\n      dataMain = dataMain.replace(jsSuffixRegExp, '');\n\n      // Set final baseUrl if there is not already an explicit one,\n      // but only do so if the data-main value is not a loader plugin\n      // module ID.\n      if ((!bootstrapConfig || !bootstrapConfig.baseUrl) &&\n          dataMain.indexOf('!') === -1) {\n        // Pull off the directory of data-main for use as the\n        // baseUrl.\n        src = dataMain.split('/');\n        dataMain = src.pop();\n        subPath = src.length ? src.join('/')  + '/' : './';\n\n        topReq.config({baseUrl: subPath});\n      }\n\n      topReq([dataMain]);\n    }\n  }\n}(this, (typeof Promise !== 'undefined' ? Promise : undefined)));\n"
  },
  {
    "path": "bower.json",
    "content": "{\n  \"name\": \"alameda\",\n  \"version\": \"1.4.0\",\n  \"ignore\": [\n    \".gitignore\",\n    \".npmignore\",\n    \"node_modules\",\n    \"package.json\",\n    \"README.md\",\n    \"tests\",\n    \"tests-requirejs\",\n    \"copyrequirejstests.sh\",\n    \"testBaseUrl.js\"\n  ],\n  \"homepage\": \"https://github.com/requirejs/alameda\",\n  \"authors\": [\n    \"jrburke.com\"\n  ],\n  \"description\": \"AMD loader, like requirejs, but with promises and for modern browsers\",\n  \"main\": \"alameda.js\",\n  \"license\": [\n    \"MIT\"\n  ]\n}\n"
  },
  {
    "path": "copyrequirejstests.sh",
    "content": "#!/bin/bash\ncp -r ../requirejs/testBaseUrl.js ./testBaseUrl.js\ncp -r ../requirejs/tests ./tests-requirejs\n"
  },
  {
    "path": "package.json",
    "content": "{\n    \"name\": \"alameda\",\n    \"description\": \"AMD loader, like requirejs, but with promises and for modern browsers\",\n    \"version\": \"1.4.0\",\n    \"homepage\": \"http://github.com/requirejs/alameda\",\n    \"author\": \"James Burke <jrburke@gmail.com> (http://github.com/jrburke)\",\n    \"license\": \"MIT\",\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/requirejs/alameda.git\"\n    },\n    \"main\": \"alameda.js\",\n    \"volo\": {\n        \"url\": \"https://raw.github.com/requirejs/alameda/{version}/alameda.js\"\n    },\n    \"engines\": {\n        \"node\": \">=0.4.0\"\n    }\n}\n"
  },
  {
    "path": "shrinktest.sh",
    "content": "#!/bin/sh\nrm alameda.min.js.gz\nls -la alameda.js\nuglifyjs -c -m -o alameda.min.js alameda.js\nls -la alameda.min.js\ngzip alameda.min.js\nls -la alameda.min.js.gz\n\n"
  },
  {
    "path": "tests/all.js",
    "content": "\ndoh.registerUrl(\"simple\", \"../simple.html\");\ndoh.registerUrl(\"defineDouble\", \"../defineDouble/defineDouble.html\");\ndoh.registerUrl(\"moduleConfig\", \"../moduleConfig/moduleConfig.html\");\ndoh.registerUrl(\"mapConfig\", \"../mapConfig/mapConfig.html\");\ndoh.registerUrl(\"mapConfigStar\", \"../mapConfig/mapConfigStar.html\");\ndoh.registerUrl(\"mapConfigStarAdapter\", \"../mapConfig/mapConfigStarAdapter.html\");\ndoh.registerUrl(\"mapConfigSpecificity\", \"../mapConfig/mapConfigSpecificity.html\");\ndoh.registerUrl(\"mapConfigPlugin\", \"../mapConfig/mapConfigPlugin.html\");\ndoh.registerUrl(\"onNodeCreated\", \"../onNodeCreated/onNodeCreated.html\");\ndoh.registerUrl(\"plugins\", \"../plugins/plugins.html\");\ndoh.registerUrl(\"pluginsMapSameName\", \"../plugins/pluginMapSameName/pluginMapSameName.html\");\ndoh.registerUrl(\"pluginsConfig\", \"../plugins/pluginsConfig/pluginsConfig.html\");\ndoh.registerUrl(\"text\", \"../plugins/text.html\");\ndoh.registerUrl(\"coffee\", \"../plugins/coffee.html\");\ndoh.registerUrl(\"shim\", \"../shim/shim.html\");\ndoh.registerUrl(\"insertRequire\", \"../insertRequire/insertRequire.html\", 4000);\ndoh.registerUrl(\"context\", \"../context/context.html\");\ndoh.registerUrl(\"circular\", \"../circular/circular.html\", 4000);\ndoh.registerUrl(\"circular414\", \"../circular/414/414.html\", 4000);\ndoh.registerUrl(\"circularTranspiler\", \"../circular/transpiler/transpiler.html\", 4000);\ndoh.registerUrl(\"relativePaths\", \"../relativePaths/relativePaths.html\");\ndoh.registerUrl(\"errback\", \"../errback/errback.html\");\ndoh.registerUrl(\"specialDeps\", \"../specialDeps/specialDeps.html\");\ndoh.registerUrl(\"hasOwnPropertyTests\", \"../hasOwnProperty/hasOwnProperty.html\");\ndoh.registerUrl(\"dataMainBaseUrl\", \"../dataMainBaseUrl/dataMainBaseUrl.html\");\ndoh.registerUrl(\"emptyRequire\", \"../emptyRequire/emptyRequire.html\");\ndoh.registerUrl(\"promiseRequire\", \"../promiseRequire/promiseRequire.html\");\ndoh.registerUrl(\"preserveDeps\", \"../preserveDeps/preserveDeps.html\");\ndoh.registerUrl(\"timeoutErrors\", \"../timeoutErrors/timeoutErrors.html\");\n"
  },
  {
    "path": "tests/circular/414/414.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: requirejs#414: Multi-cycle Bundle Test</title>\n    <script type=\"text/javascript\" src=\"../../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../doh/_browserRunner.js\"></script>\n    <script src=\"../../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"414.js\"></script>\n</head>\n<body>\n    <h1>alameda: requirejs#414: Multi-cycle Bundle Test</h1>\n\n    <p>A set of modules have multiple cycles in them, but the require() that\n        uses the top module in that bundle should get a fully constructed\n        module set.<a href=\"https://github.com/requirejs/requirejs/issues/414\">More info</a>.</p>\n\n    <p>Check console for messages</p>\n\n</body>\n</html>\n"
  },
  {
    "path": "tests/circular/414/414.js",
    "content": "\ndefine('C',\r\n    [\r\n        \"exports\",\r\n        \"./MyClass\",\r\n        \"./A\",\r\n        \"./B\"\r\n    ],\r\n\r\n    function (exports, MyClass, A, B) {\r\n\r\n        exports.name = \"C\";\r\n\r\n        exports.say = function(){\r\n            return [MyClass.name, A.name, B.name, exports.name].join(',');\r\n        };\r\n\r\n    }\r\n\r\n);\r\n\r\n\ndefine('B',\r\n    [\r\n        \"exports\",\r\n        \"./MyClass\",\r\n        \"./A\",\r\n        \"./C\"\r\n    ],\r\n\r\n    function (exports, MyClass, A, C) {\r\n\r\n        exports.name = \"B\";\r\n\r\n        exports.say = function(){\r\n            return [MyClass.name, A.name, exports.name, C.name].join(',');\r\n        };\r\n\r\n    }\r\n\r\n);\ndefine('A',\r\n    [\r\n        \"exports\",\r\n        \"./MyClass\",\r\n        \"./B\",\r\n        \"./C\"\r\n    ],\r\n\r\n    function (exports, MyClass, B, C) {\r\n\r\n        exports.name = \"A\";\r\n\r\n        exports.say = function(){\r\n            return [MyClass.name, exports.name, B.name, C.name].join(',');\r\n        };\r\n\r\n    }\r\n\r\n);\r\n\ndefine('MyClass',\r\n    [\r\n        \"exports\",\r\n        \"./A\",\r\n        \"./B\",\r\n        \"./C\"\r\n    ],\r\n\r\n    function (exports, A, B, C) {\r\n\r\n        exports.name = \"MyClass\";\r\n\r\n        exports.sayAll = function(){\r\n            return [\r\n                exports.say(),\r\n                A.say(),\r\n                B.say(),\r\n                C.say()\r\n            ].join(':');\r\n        };\r\n\r\n        exports.say = function(){\r\n            return [exports.name, A.name, B.name, C.name].join(',');\r\n        };\r\n\r\n        return exports;\r\n\r\n    }\r\n\r\n);\r\n\nrequire({\n        baseUrl: requirejs.isBrowser ? './' : './circular/414'\n    },\n    [\"MyClass\"],\n    function(MyClass) {\n        doh.register(\n            \"circular414\",\n            [\n                function circularComplexPlugin(t) {\n                    t.is(\"MyClass,A,B,C:MyClass,A,B,C:MyClass,A,B,C:MyClass,A,B,C\", MyClass.sayAll());\n                 }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"414-tests\", function(){});\n"
  },
  {
    "path": "tests/circular/circular.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: circular Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n        define('a', ['b', 'require'], function (b, require) {\n            return {\n                name: 'a',\n                getB: function () {\n                    return require('b');\n                }\n            }\n        });\n\n        define('b', ['a', 'require'], function (a, require) {\n            return {\n                name: 'b',\n                getA: function () {\n                    return require('a');\n                }\n            }\n        });\n\n        define('c', ['require', 'exports', 'd'], function (require, exports) {\n            exports.name = 'c',\n            exports.d = require('d');\n        });\n\n        define('d', ['require', 'exports', 'c'], function (require, exports) {\n            exports.name = 'd',\n            exports.c = require('c');\n        });\n\n        require(['a', 'c', 'd'], function (a, c, d) {\n            doh.register(\n                'circular',\n                [\n                    function circular(t){\n                        b = a.getB();\n                        t.is('a', a.name);\n                        t.is('b', b.name);\n                        t.is('a', b.getA().name);\n                        t.is('c', c.name);\n                        t.is('d', c.d.name);\n                        t.is('d', d.name);\n                        t.is('c', d.c.name);\n                    }\n                ]\n            );\n            doh.run();\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: circular Test</h1>\n\n    <p>Test circular dependencies with alameda. More info:\n    <a href=\"https://github.com/requirejs/almond/issues/17\">17</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/circular/transpiler/transpiler.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Circular Transpiler Plugin Test</title>\n    <script type=\"text/javascript\" src=\"../../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../doh/_browserRunner.js\"></script>\n    <script src=\"../../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"transpiler.js\"></script>\n</head>\n<body>\n    <h1>alameda: Circular Transpiler Plugin Test</h1>\n\n    <p>Test support for transpiled modules with cycles in them More info:\n    <a href=\"https://github.com/requirejs/requirejs/issues/356\">356</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/circular/transpiler/transpiler.js",
    "content": "\n\n/*jslint strict: false, plusplus: false */\n/*global define: false, require: false,  XMLHttpRequest: false, ActiveXObject: false,\n  window: false, Packages: false, java: false, process: false */\n\n(function () {\n    //Load the text plugin, so that the XHR calls can be made.\n    var buildMap = {}, fetchText, fs,\n        progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];\n\n    function createXhr() {\n        //Would love to dump the ActiveX crap in here. Need IE 6 to die first.\n        var xhr, i, progId;\n        if (typeof XMLHttpRequest !== \"undefined\") {\n            return new XMLHttpRequest();\n        } else {\n            for (i = 0; i < 3; i++) {\n                progId = progIds[i];\n                try {\n                    xhr = new ActiveXObject(progId);\n                } catch (e) {}\n\n                if (xhr) {\n                    progIds = [progId];  // so faster next time\n                    break;\n                }\n            }\n        }\n\n        if (!xhr) {\n            throw new Error(\"require.getXhr(): XMLHttpRequest not available\");\n        }\n\n        return xhr;\n    }\n\n    if (typeof window !== \"undefined\" && window.navigator && window.document) {\n        fetchText = function (url, callback) {\n            var xhr = createXhr();\n            xhr.open('GET', url, true);\n            xhr.onreadystatechange = function (evt) {\n                //Do not explicitly handle errors, those should be\n                //visible via console output in the browser.\n                if (xhr.readyState === 4) {\n                    callback(xhr.responseText);\n                }\n            };\n            xhr.send(null);\n        };\n    } else if (typeof process !== \"undefined\" &&\n             process.versions &&\n             !!process.versions.node) {\n        //Using special require.nodeRequire, something added by r.js.\n        fs = require.nodeRequire('fs');\n\n        fetchText = function (url, callback) {\n            callback(fs.readFileSync(url, 'utf8'));\n        };\n    } else if (typeof Packages !== 'undefined') {\n        //Why Java, why is this so awkward?\n        fetchText = function (url, callback) {\n            var encoding = \"utf-8\",\n                file = new java.io.File(url),\n                lineSeparator = java.lang.System.getProperty(\"line.separator\"),\n                input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),\n                stringBuffer, line,\n                content = '';\n            try {\n                stringBuffer = new java.lang.StringBuffer();\n                line = input.readLine();\n\n                // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324\n                // http://www.unicode.org/faq/utf_bom.html\n\n                // Note that when we use utf-8, the BOM should appear as \"EF BB BF\", but it doesn't due to this bug in the JDK:\n                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058\n                if (line && line.length() && line.charAt(0) === 0xfeff) {\n                    // Eat the BOM, since we've already found the encoding on this file,\n                    // and we plan to concatenating this buffer with others; the BOM should\n                    // only appear at the top of a file.\n                    line = line.substring(1);\n                }\n\n                stringBuffer.append(line);\n\n                while ((line = input.readLine()) !== null) {\n                    stringBuffer.append(lineSeparator);\n                    stringBuffer.append(line);\n                }\n                //Make sure we return a JavaScript string and not a Java string.\n                content = String(stringBuffer.toString()); //String\n            } finally {\n                input.close();\n            }\n            callback(content);\n        };\n    }\n\n    define('refine',[],function () {\n        return {\n            load: function (name, parentRequire, load, config) {\n                var url = parentRequire.toUrl(name + '.refine');\n                fetchText(url, function (text) {\n                    text = text.replace(/refine\\s*\\(/g, 'define(');\n\n                    if (config.isBuild) {\n                        buildMap[name] = text;\n                    }\n\n                    //Add in helpful debug line\n                    text += \"\\r\\n//@ sourceURL=\" + url;\n\n                    load.fromText(text);\n\n                    parentRequire([name], function (value) {\n                        load(value);\n                    });\n                });\n            },\n\n            write: function (pluginName, name, write) {\n                if (name in buildMap) {\n                    var text = buildMap[name];\n                    write.asModule(pluginName + \"!\" + name, text);\n                }\n            }\n        };\n    });\n\n}());\n\ndefine('refine!c',['refine!a', 'exports'], function (a, exports) {\n    exports.name = 'c';\n    exports.a = a;\n});\n\ndefine('refine!b',['refine!c', 'exports'], function (c, exports) {\n    exports.name = 'b';\n    exports.c = c;\n});\n\ndefine('refine!a',['refine!b', 'exports'], function (b, exports) {\n    exports.name = 'a';\n    exports.b = b;\n});\n\ndefine('refine!e',['refine!d'], function(d) {\n    function e() {\n        return e.name + require('refine!d').name;\n    }\n\n    e.name = 'e';\n\n    return e;\n});\ndefine('refine!d',['refine!e'], function(e) {\n    function d() {\n        return require('refine!e')();\n    }\n\n    d.name = 'd';\n\n    return d;\n});\nrequire({\n        baseUrl: requirejs.isBrowser ? './' : './circular/transpiler',\n        paths: {\n            'text': '../../../../text/text',\n            'refine': '../../plugins/fromText/refine'\n        }\n    },\n    [\"require\", \"refine!a\", \"refine!b\", \"refine!d\"],\n    function(require, a, b, d) {\n        doh.register(\n            \"circularTranspiler\",\n            [\n                function circularTranspiler(t) {\n                    t.is(\"a\", a.name);\n                    t.is(\"b\", a.b.name);\n                    t.is(\"c\", a.b.c.name);\n                    t.is(\"b\", b.name);\n                    t.is(\"c\", b.c.name);\n                    t.is(\"ed\", d());\n                 }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"transpiler-tests\", function(){});\n"
  },
  {
    "path": "tests/context/context.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Context Test</title>\n    <script src=\"../doh/runner.js\"></script>\n    <script src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script>\n    \tvar fooContext = requirejs.config({ context: 'foo' });\n    \tvar fooContext2 = requirejs.config({ context: 'foo' });\n\n        doh.register(\n            'context',\n            [\n                function context(t){\n                    t.is(fooContext, fooContext2);\n                }\n            ]\n        );\n        doh.run();\n\n    </script>\n</head>\n<body>\n    <h1>alameda: Context Test</h1>\n    <p>Two requirejs.config calls to the same context should operate on the same context.\n        <a href=\"https://github.com/requirejs/alameda/issues/25\">More info</a></p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/dataMainBaseUrl/dataMainBaseUrl.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: dataMain baseUrl Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" data-main=\"js/sub/main.js\" src=\"../../alameda.js\"></script>\n</head>\n<body>\n    <h1>alameda: dataMain baseUrl Test</h1>\n\n    <p>Makes sure alameda sets baseUrl from data-main. More info:\n    <a href=\"https://github.com/requirejs/alameda/issues/3\">3</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/dataMainBaseUrl/js/sub/main.js",
    "content": "require(['other'], function(other){\n    doh.register(\n        'dataMainBaseUrl',\n        [\n            function dataMainBaseUrl(t){\n                t.is('other', other.name);\n            }\n        ]\n    );\n    doh.run();\n});"
  },
  {
    "path": "tests/dataMainBaseUrl/js/sub/other.js",
    "content": "define({\n    name: 'other'\n});\n"
  },
  {
    "path": "tests/defineDouble/defineDouble.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Define Double Test</title>\n    <script src=\"../doh/runner.js\"></script>\n    <script src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script>\n        var aCount = 0,\n            bCount = 0;\n\n        define('a', function () {\n            aCount += 1;\n        });\n        define('a', function () {\n            aCount += 1;\n        });\n\n        define('b', function() {\n            bCount += 1;\n        });\n\n        require(['b'], function() {\n\n            define('b', function() {\n                bCount += 1;\n            });\n\n            require(['a', 'b'], function () {\n                doh.register(\n                    'defineDouble',\n                    [\n                        function defineDouble(t){\n                            t.is(1, aCount);\n                            t.is(1, bCount);\n                        }\n                    ]\n                );\n                doh.run();\n            });\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: Define Double Test</h1>\n    <p>Make sure a double define only uses the first one.\n        <a href=\"https://github.com/requirejs/almond/issues/43\">More info</a></p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/doh/LICENSE",
    "content": "Dojo is available under *either* the terms of the modified BSD license *or* the\nAcademic Free License version 2.1. As a recipient of Dojo, you may choose which\nlicense to receive this code under (except as noted in per-module LICENSE\nfiles). Some modules may not be the copyright of the Dojo Foundation. These\nmodules contain explicit declarations of copyright in both the LICENSE files in\nthe directories in which they reside and in the code itself. No external\ncontributions are allowed under licenses which are fundamentally incompatible\nwith the AFL or BSD licenses that Dojo is distributed under.\n\nThe text of the AFL and BSD licenses is reproduced below. \n\n-------------------------------------------------------------------------------\nThe \"New\" BSD License:\n**********************\n\nCopyright (c) 2005-2009, The Dojo Foundation\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n  * Redistributions of source code must retain the above copyright notice, this\n    list of conditions and the following disclaimer.\n  * Redistributions in binary form must reproduce the above copyright notice,\n    this list of conditions and the following disclaimer in the documentation\n    and/or other materials provided with the distribution.\n  * Neither the name of the Dojo Foundation nor the names of its contributors\n    may be used to endorse or promote products derived from this software\n    without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n-------------------------------------------------------------------------------\nThe Academic Free License, v. 2.1:\n**********************************\n\nThis Academic Free License (the \"License\") applies to any original work of\nauthorship (the \"Original Work\") whose owner (the \"Licensor\") has placed the\nfollowing notice immediately following the copyright notice for the Original\nWork:\n\nLicensed under the Academic Free License version 2.1\n\n1) Grant of Copyright License. Licensor hereby grants You a world-wide,\nroyalty-free, non-exclusive, perpetual, sublicenseable license to do the\nfollowing:\n\na) to reproduce the Original Work in copies;\n\nb) to prepare derivative works (\"Derivative Works\") based upon the Original\nWork;\n\nc) to distribute copies of the Original Work and Derivative Works to the\npublic;\n\nd) to perform the Original Work publicly; and\n\ne) to display the Original Work publicly.\n\n2) Grant of Patent License. Licensor hereby grants You a world-wide,\nroyalty-free, non-exclusive, perpetual, sublicenseable license, under patent\nclaims owned or controlled by the Licensor that are embodied in the Original\nWork as furnished by the Licensor, to make, use, sell and offer for sale the\nOriginal Work and Derivative Works.\n\n3) Grant of Source Code License. The term \"Source Code\" means the preferred\nform of the Original Work for making modifications to it and all available\ndocumentation describing how to modify the Original Work. Licensor hereby\nagrees to provide a machine-readable copy of the Source Code of the Original\nWork along with each copy of the Original Work that Licensor distributes.\nLicensor reserves the right to satisfy this obligation by placing a\nmachine-readable copy of the Source Code in an information repository\nreasonably calculated to permit inexpensive and convenient access by You for as\nlong as Licensor continues to distribute the Original Work, and by publishing\nthe address of that information repository in a notice immediately following\nthe copyright notice that applies to the Original Work.\n\n4) Exclusions From License Grant. Neither the names of Licensor, nor the names\nof any contributors to the Original Work, nor any of their trademarks or\nservice marks, may be used to endorse or promote products derived from this\nOriginal Work without express prior written permission of the Licensor. Nothing\nin this License shall be deemed to grant any rights to trademarks, copyrights,\npatents, trade secrets or any other intellectual property of Licensor except as\nexpressly stated herein. No patent license is granted to make, use, sell or\noffer to sell embodiments of any patent claims other than the licensed claims\ndefined in Section 2. No right is granted to the trademarks of Licensor even if\nsuch marks are included in the Original Work. Nothing in this License shall be\ninterpreted to prohibit Licensor from licensing under different terms from this\nLicense any Original Work that Licensor otherwise would have a right to\nlicense.\n\n5) This section intentionally omitted.\n\n6) Attribution Rights. You must retain, in the Source Code of any Derivative\nWorks that You create, all copyright, patent or trademark notices from the\nSource Code of the Original Work, as well as any notices of licensing and any\ndescriptive text identified therein as an \"Attribution Notice.\" You must cause\nthe Source Code for any Derivative Works that You create to carry a prominent\nAttribution Notice reasonably calculated to inform recipients that You have\nmodified the Original Work.\n\n7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that\nthe copyright in and to the Original Work and the patent rights granted herein\nby Licensor are owned by the Licensor or are sublicensed to You under the terms\nof this License with the permission of the contributor(s) of those copyrights\nand patent rights. Except as expressly stated in the immediately proceeding\nsentence, the Original Work is provided under this License on an \"AS IS\" BASIS\nand WITHOUT WARRANTY, either express or implied, including, without limitation,\nthe warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.\nThis DISCLAIMER OF WARRANTY constitutes an essential part of this License. No\nlicense to Original Work is granted hereunder except under this disclaimer.\n\n8) Limitation of Liability. Under no circumstances and under no legal theory,\nwhether in tort (including negligence), contract, or otherwise, shall the\nLicensor be liable to any person for any direct, indirect, special, incidental,\nor consequential damages of any character arising as a result of this License\nor the use of the Original Work including, without limitation, damages for loss\nof goodwill, work stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses. This limitation of liability shall not\napply to liability for death or personal injury resulting from Licensor's\nnegligence to the extent applicable law prohibits such limitation. Some\njurisdictions do not allow the exclusion or limitation of incidental or\nconsequential damages, so this exclusion and limitation may not apply to You.\n\n9) Acceptance and Termination. If You distribute copies of the Original Work or\na Derivative Work, You must make a reasonable effort under the circumstances to\nobtain the express assent of recipients to the terms of this License. Nothing\nelse but this License (or another written agreement between Licensor and You)\ngrants You permission to create Derivative Works based upon the Original Work\nor to exercise any of the rights granted in Section 1 herein, and any attempt\nto do so except under the terms of this License (or another written agreement\nbetween Licensor and You) is expressly prohibited by U.S. copyright law, the\nequivalent laws of other countries, and by international treaty. Therefore, by\nexercising any of the rights granted to You in Section 1 herein, You indicate\nYour acceptance of this License and all of its terms and conditions.\n\n10) Termination for Patent Action. This License shall terminate automatically\nand You may no longer exercise any of the rights granted to You by this License\nas of the date You commence an action, including a cross-claim or counterclaim,\nagainst Licensor or any licensee alleging that the Original Work infringes a\npatent. This termination provision shall not apply for an action alleging\npatent infringement by combinations of the Original Work with other software or\nhardware.\n\n11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this\nLicense may be brought only in the courts of a jurisdiction wherein the\nLicensor resides or in which Licensor conducts its primary business, and under\nthe laws of that jurisdiction excluding its conflict-of-law provisions. The\napplication of the United Nations Convention on Contracts for the International\nSale of Goods is expressly excluded. Any use of the Original Work outside the\nscope of this License or after its termination shall be subject to the\nrequirements and penalties of the U.S. Copyright Act, 17 U.S.C. Â§ 101 et\nseq., the equivalent laws of other countries, and international treaty. This\nsection shall survive the termination of this License.\n\n12) Attorneys Fees. In any action to enforce the terms of this License or\nseeking damages relating thereto, the prevailing party shall be entitled to\nrecover its costs and expenses, including, without limitation, reasonable\nattorneys' fees and costs incurred in connection with such action, including\nany appeal of such action. This section shall survive the termination of this\nLicense.\n\n13) Miscellaneous. This License represents the complete agreement concerning\nthe subject matter hereof. If any provision of this License is held to be\nunenforceable, such provision shall be reformed only to the extent necessary to\nmake it enforceable.\n\n14) Definition of \"You\" in This License. \"You\" throughout this License, whether\nin upper or lower case, means an individual or a legal entity exercising rights\nunder, and complying with all of the terms of, this License. For legal\nentities, \"You\" includes any entity that controls, is controlled by, or is\nunder common control with you. For purposes of this definition, \"control\" means\n(i) the power, direct or indirect, to cause the direction or management of such\nentity, whether by contract or otherwise, or (ii) ownership of fifty percent\n(50%) or more of the outstanding shares, or (iii) beneficial ownership of such\nentity.\n\n15) Right to Use. You may use the Original Work in all ways not otherwise\nrestricted or conditioned by this License or by law, and Licensor promises not\nto interfere with or be responsible for such uses by You.\n\nThis license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.\nPermission is hereby granted to copy and distribute this license without\nmodification. This license may not be modified without the express written\npermission of its copyright owner.\n"
  },
  {
    "path": "tests/doh/README",
    "content": "DOH may be run standalone by issuing a command like the following:\n\njava -jar ../shrinksafe/js.jar runner.js testModule=tests.colors\n\nwhere the testModule argument is optional and shrinksafe/js.jar is just a\nconvenient copy of the Rhino JavaScript engine -- the custom patch is not\nrequired.\n\nOptional arguments include:\n * dojoUrl - specifies the location of dojo.js\n * testUrl - specifies a Javascript file to load with initialization code\n * testModule - specifies a test module in the dojo package namespace\n"
  },
  {
    "path": "tests/doh/_browserRunner.js",
    "content": "if(window[\"dojo\"]){\n\tdojo.provide(\"doh._browserRunner\");\n}\n\n// FIXME: need to add prompting for monkey-do testing\n\n(function(){\n\n\tdoh.setTimeout = function (fn, time) {\n            return setTimeout(fn, time);\n        };\n\n\ttry{\n\t\tvar topdog = (window.parent == window) || !Boolean(window.parent.doh);\n\t}catch(e){\n\t\t//can't access window.parent.doh, then consider ourselves as topdog\n\t\ttopdog=true;\n\t}\n\tif(topdog){\n\t\t// we're the top-dog window.\n\n\t\t// borrowed from Dojo, etc.\n\t\tvar byId = function(id){\n\t\t\treturn document.getElementById(id);\n\t\t};\n\n\t\tvar _addOnEvt = function(\ttype,\t\t// string\n\t\t\t\t\t\t\t\t\trefOrName,\t// function or string\n\t\t\t\t\t\t\t\t\tscope){\t\t// object, defaults is window\n\n\t\t\tif(!scope){ scope = window; }\n\n\t\t\tvar funcRef = refOrName;\n\t\t\tif(typeof refOrName == \"string\"){\n\t\t\t\tfuncRef = scope[refOrName];\n\t\t\t}\n\t\t\tvar enclosedFunc = function(){ return funcRef.apply(scope, arguments); };\n\n\t\t\tif((window[\"dojo\"])&&(type == \"load\")){\n\t\t\t\tdojo.addOnLoad(enclosedFunc);\n\t\t\t}else{\n\t\t\t\tif(window[\"attachEvent\"]){\n\t\t\t\t\twindow.attachEvent(\"on\"+type, enclosedFunc);\n\t\t\t\t}else if(window[\"addEventListener\"]){\n\t\t\t\t\twindow.addEventListener(type, enclosedFunc, false);\n\t\t\t\t}else if(document[\"addEventListener\"]){\n\t\t\t\t\tdocument.addEventListener(type, enclosedFunc, false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t//\n\t\t// Over-ride or implement base runner.js-provided methods\n\t\t//\n\t\tvar escapeXml = function(str){\n\t\t\t//summary:\n\t\t\t//\t\tAdds escape sequences for special characters in XML: &<>\"'\n\t\t\t//\t\tOptionally skips escapes for single quotes\n\t\t\treturn str.replace(/&/gm, \"&amp;\").replace(/</gm, \"&lt;\").replace(/>/gm, \"&gt;\").replace(/\"/gm, \"&quot;\"); // string\n\t\t};\n\n\t\tvar _logBacklog = [], _loggedMsgLen = 0;\n\t\tvar sendToLogPane = function(args, skip){\n\t\t\tvar msg = \"\";\n\t\t\tfor(var x=0; x<args.length; x++){\n\t\t\t\tmsg += \" \"+args[x];\n\t\t\t}\n\n\t\t\tmsg = escapeXml(msg);\n\n\t\t\t// workarounds for IE. Wheeee!!!\n\t\t\tmsg = msg.replace(\"\\t\", \"&nbsp;&nbsp;&nbsp;&nbsp;\")\n\t\t\t\t.replace(\" \", \"&nbsp;\")\n\t\t\t\t.replace(\"\\n\", \"<br>&nbsp;\");\n\t\t\tif(!byId(\"logBody\")){\n\t\t\t\t_logBacklog.push(msg);\n\t\t\t\treturn;\n\t\t\t}else if(_logBacklog.length && !skip){\n\t\t\t\tvar tm;\n\t\t\t\twhile((tm=_logBacklog.shift())){\n\t\t\t\t\tsendToLogPane(tm, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar logBody=byId(\"logBody\");\n\t\t\tvar tn = document.createElement(\"div\");\n\t\t\ttn.innerHTML = msg;\n\t\t\t//tn.id=\"logmsg_\"+logBody.childNodes.length;\n\t\t\tlogBody.appendChild(tn);\n\t\t\t_loggedMsgLen++;\n\t\t}\n\n\t\tvar findTarget = function(n){\n\t\t\twhile(n && !n.getAttribute('_target')){\n\t\t\t\tn=n.parentNode;\n\t\t\t\tif(!n.getAttribute){\n\t\t\t\t\tn=null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn n;\n\t\t}\n\n\t\tdoh._jumpToLog = function(e){\n\t\t\t//console.log(e);\n\n\t\t\tvar node = findTarget(e?e.target:window.event.srcElement);\n\t\t\tif(!node){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar _t = Number(node.getAttribute('_target'));\n\t\t\tvar lb = byId(\"logBody\");\n\t\t\tif(_t>=lb.childNodes.length){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar t = lb.childNodes[_t];\n\t\t\tt.scrollIntoView();\n\t\t\tif(window.dojo){\n\t\t\t\t//t.parentNode.parentNode is <div class=\"tabBody\">, only it has a explicitly set background-color,\n\t\t\t\t//all children of it are transparent\n\t\t\t\tvar bgColor = dojo.style(t.parentNode.parentNode,'backgroundColor');\n\t\t\t\t//node.parentNode is the tr which has background-color set explicitly\n\t\t\t\tvar hicolor = dojo.style(node.parentNode,'backgroundColor');\n\t\t\t\tvar unhilight = dojo.animateProperty({\n\t\t\t\t\tnode: t,\n\t\t\t\t\tduration: 500,\n\t\t\t\t\tproperties:\n\t\t\t\t\t{\n\t\t\t\t\t\tbackgroundColor: { start:hicolor, end: bgColor }\n\t\t\t\t\t},\n\t\t\t\t\tonEnd: function(){\n\t\t\t\t\t\tt.style.backgroundColor=\"\";\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tvar hilight = dojo.animateProperty({\n\t\t\t\t\tnode: t,\n\t\t\t\t\tduration: 500,\n\t\t\t\t\tproperties:\n\t\t\t\t\t{\n\t\t\t\t\t\tbackgroundColor: { start:bgColor, end: hicolor }\n\t\t\t\t\t},\n\t\t\t\t\tonEnd: function(){\n\t\t\t\t\t\tunhilight.play();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\thilight.play();\n\t\t\t}\n\t\t};\n\n\t\tdoh._jumpToSuite = function(e){\n\t\t\tvar node = findTarget(e ? e.target : window.event.srcElement);\n\t\t\tif(!node){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar _g = node.getAttribute('_target');\n\t\t\tvar gn = getGroupNode(_g);\n\t\t\tif(!gn){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgn.scrollIntoView();\n\t\t};\n\n\t\tdoh._init = (function(oi){\n\t\t\treturn function(){\n\t\t\t\tvar lb = byId(\"logBody\");\n\t\t\t\tif(lb){\n\t\t\t\t\t// clear the console before each run\n\t\t\t\t\twhile(lb.firstChild){\n\t\t\t\t\t\tlb.removeChild(lb.firstChild);\n\t\t\t\t\t}\n\t\t\t\t\t_loggedMsgLen = 0;\n\t\t\t\t}\n\t\t\t\tthis._totalTime = 0;\n\t\t\t\tthis._suiteCount = 0;\n\t\t\t\toi.apply(doh, arguments);\n\t\t\t}\n\t\t})(doh._init);\n\n\t\tdoh._setupGroupForRun = (function(os){\n\t\t\t//overload _setupGroupForRun to record which log line to jump to when a suite is clicked\n\t\t\treturn function(groupName){\n\t\t\t\tvar tg = doh._groups[groupName];\n\t\t\t\tdoh._curTestCount = tg.length;\n\t\t\t\tdoh._curGroupCount = 1;\n\t\t\t\tvar gn = getGroupNode(groupName);\n\t\t\t\tif(gn){\n\t\t\t\t\t//two lines will be added, scroll the second line into view\n\t\t\t\t\tgn.getElementsByTagName(\"td\")[2].setAttribute('_target',_loggedMsgLen+1);\n\t\t\t\t}\n\t\t\t\tos.apply(doh,arguments);\n\t\t\t}\n\t\t})(doh._setupGroupForRun);\n\n\t\tdoh._report = (function(or){\n\t\t\t//overload _report to insert a tfoot\n\t\t\treturn function(){\n\t\t\t\tvar tb = byId(\"testList\");\n\t\t\t\tif(tb){\n\t\t\t\t\tvar tfoots=tb.getElementsByTagName('tfoot');\n\t\t\t\t\tif(tfoots.length){\n\t\t\t\t\t\ttb.removeChild(tfoots[0]);\n\t\t\t\t\t}\n\t\t\t\t\tvar foot = tb.createTFoot();\n\t\t\t\t\tvar row = foot.insertRow(-1);\n\t\t\t\t\trow.className = 'inProgress';\n\t\t\t\t\tvar cell=row.insertCell(-1);\n\t\t\t\t\tcell.colSpan=2;\n\t\t\t\t\tcell.innerHTML=\"Result\";\n\t\t\t\t\tcell = row.insertCell(-1);\n\t\t\t\t\tcell.innerHTML=this._testCount+\" tests in \"+this._groupCount+\" groups /<span class='failure'>\"+this._errorCount+\"</span> errors, <span class='failure'>\"+this._failureCount+\"</span> failures\";\n\t\t\t\t\tcell.setAttribute('_target',_loggedMsgLen+1);\n\t\t\t\t\trow.insertCell(-1).innerHTML=doh._totalTime+\"ms\";\n\t\t\t\t}\n\n\t\t\t\t//This location can do the final performance rendering for the results\n\t\t\t\t//of any performance tests.\n\t\t\t\tvar plotResults = null;\n\t\t\t\tvar standby;\n\t\t\t\tif(doh.perfTestResults){\n\t\t\t\t\tif(window.dojo){\n\t\t\t\t\t\t//If we have dojo and here are perf tests results,\n\t\t\t\t\t\t//well, we'll use the dojo charting functions\n\t\t\t\t\t\tdojo.require(\"dojox.charting.Chart2D\");\n\t\t\t\t\t\tdojo.require(\"dojox.charting.DataChart\");\n\t\t\t\t\t\tdojo.require(\"dojox.charting.plot2d.Scatter\");\n\t\t\t\t\t\tdojo.require(\"dojox.charting.plot2d.Lines\");\n\t\t\t\t\t\tdojo.require(\"dojo.data.ItemFileReadStore\");\n\t\t\t\t\t\tplotResults = doh._dojoPlotPerfResults;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tplotResults = doh._asciiPlotPerfResults;\n\t\t\t\t\t}\n\t\t\t\t\ttry{\n\t\t\t\t\t\tvar g;\n\t\t\t\t\t\tvar pBody = byId(\"perfTestsBody\");\n\t\t\t\t\t\tvar chartsToRender = [];\n\n\t\t\t\t\t\tif(doh.perfTestResults){\n\t\t\t\t\t\t\tdoh.showPerfTestsPage();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(g in doh.perfTestResults){\n\t\t\t\t\t\t\tvar grp = doh.perfTestResults[g];\n\t\t\t\t\t\t\tvar hdr = document.createElement(\"h1\");\n\t\t\t\t\t\t\thdr.appendChild(document.createTextNode(\"Group: \" + g));\n\t\t\t\t\t\t\tpBody.appendChild(hdr);\n\t\t\t\t\t\t\tvar ind = document.createElement(\"blockquote\");\n\t\t\t\t\t\t\tpBody.appendChild(ind);\n\t\t\t\t\t\t\tvar f;\n\t\t\t\t\t\t\tfor(f in grp){\n\t\t\t\t\t\t\t\tvar fResults = grp[f];\n\t\t\t\t\t\t\t\tif(!fResults){ continue; }\n\t\t\t\t\t\t\t\tvar fhdr = document.createElement(\"h3\");\n\t\t\t\t\t\t\t\tfhdr.appendChild(document.createTextNode(\"TEST: \" + f));\n\t\t\t\t\t\t\t\tfhdr.style.textDecoration = \"underline\";\n\t\t\t\t\t\t\t\tind.appendChild(fhdr);\n\t\t\t\t\t\t\t\tvar div = document.createElement(\"div\");\n\t\t\t\t\t\t\t\tind.appendChild(div);\n\n\t\t\t\t\t\t\t\t//Figure out the basic info\n\t\t\t\t\t\t\t\tvar results = \"<b>TRIAL SIZE: </b>\"  + fResults.trials[0].testIterations + \" iterations<br>\" +\n\t\t\t\t\t\t\t\t\t\"<b>NUMBER OF TRIALS: </b>\" + fResults.trials.length + \"<br>\";\n\n\t\t\t\t\t\t\t\t//Figure out the average test pass cost.\n\t\t\t\t\t\t\t\tvar i;\n\t\t\t\t\t\t\t\tvar iAvgArray = [];\n\t\t\t\t\t\t\t\tvar tAvgArray = [];\n\t\t\t\t\t\t\t\tfor(i = 0; i < fResults.trials.length; i++){\n\t\t\t\t\t\t\t\t\tiAvgArray.push(fResults.trials[i].average);\n\t\t\t\t\t\t\t\t\ttAvgArray.push(fResults.trials[i].executionTime);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tresults += \"<b>AVERAGE TRIAL EXECUTION TIME: </b>\" + doh.average(tAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>MAXIMUM TEST ITERATION TIME: </b>\" + doh.max(iAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>MINIMUM TEST ITERATION TIME: </b>\" + doh.min(iAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>AVERAGE TEST ITERATION TIME: </b>\" + doh.average(iAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>MEDIAN TEST ITERATION TIME: </b>\" + doh.median(iAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>VARIANCE TEST ITERATION TIME: </b>\" + doh.variance(iAvgArray).toFixed(10) + \"ms.<br>\";\n\t\t\t\t\t\t\t\tresults += \"<b>STANDARD DEVIATION ON TEST ITERATION TIME: </b>\" + doh.standardDeviation(iAvgArray).toFixed(10) + \"ms.<br>\";\n\n\t\t\t\t\t\t\t\t//Okay, attach it all in.\n\t\t\t\t\t\t\t\tdiv.innerHTML = results;\n\n\t\t\t\t\t\t\t\tdiv = document.createElement(\"div\");\n\t\t\t\t\t\t\t\tdiv.innerHTML = \"<h3>Average Test Execution Time (in milliseconds, with median line)</h3>\";\n\t\t\t\t\t\t\t\tind.appendChild(div);\n\t\t\t\t\t\t\t\tdiv = document.createElement(\"div\");\n\t\t\t\t\t\t\t\tdojo.style(div, \"width\", \"600px\");\n\t\t\t\t\t\t\t\tdojo.style(div, \"height\", \"250px\");\n\t\t\t\t\t\t\t\tind.appendChild(div);\n\t\t\t\t\t\t\t\tchartsToRender.push({\n\t\t\t\t\t\t\t\t\tdiv: div,\n\t\t\t\t\t\t\t\t\ttitle: \"Average Test Execution Time\",\n\t\t\t\t\t\t\t\t\tdata: iAvgArray\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tdiv = document.createElement(\"div\");\n\t\t\t\t\t\t\t\tdiv.innerHTML = \"<h3>Average Trial Execution Time (in milliseconds, with median line)</h3>\";\n\t\t\t\t\t\t\t\tind.appendChild(div);\n\t\t\t\t\t\t\t\tdiv = document.createElement(\"div\");\n\t\t\t\t\t\t\t\tdojo.style(div, \"width\", \"600px\");\n\t\t\t\t\t\t\t\tdojo.style(div, \"height\", \"250px\");\n\t\t\t\t\t\t\t\tind.appendChild(div);\n\t\t\t\t\t\t\t\tchartsToRender.push({\n\t\t\t\t\t\t\t\t\tdiv: div,\n\t\t\t\t\t\t\t\t\ttitle: \"Average Trial Execution Time\",\n\t\t\t\t\t\t\t\t\tdata: tAvgArray\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t//Lazy-render these to give the browser time and not appear locked.\n\t\t\t\t\t\tvar delayedRenders = function() {\n\t\t\t\t\t\t\tif(chartsToRender.length){\n\t\t\t\t\t\t\t\tvar chartData = chartsToRender.shift();\n\t\t\t\t\t\t\t\tplotResults(chartData.div, chartData.title, chartData.data);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdoh.setTimeout(delayedRenders, 50);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdoh.setTimeout(delayedRenders, 150);\n\t\t\t\t\t}catch(e){\n\t\t\t\t\t\tdoh.debug(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tor.apply(doh,arguments);\n\t\t\t}\n\t\t})(doh._report);\n\n\t\tif(this[\"opera\"] && opera.postError){\n\t\t\tdoh.debug = function(){\n\t\t\t\tvar msg = \"\";\n\t\t\t\tfor(var x=0; x<arguments.length; x++){\n\t\t\t\t\tmsg += \" \"+arguments[x];\n\t\t\t\t}\n\t\t\t\tsendToLogPane([msg]);\n\t\t\t\topera.postError(\"DEBUG:\"+msg);\n\t\t\t}\n\t\t}else if(window[\"console\"]){\n\t\t\tdoh.debug = function(){\n\t\t\t\tvar msg = \"\";\n\t\t\t\tfor(var x=0; x<arguments.length; x++){\n\t\t\t\t\tmsg += \" \"+arguments[x];\n\t\t\t\t}\n\t\t\t\tsendToLogPane([msg]);\n\t\t\t\tconsole.log(\"DEBUG:\"+msg);\n\t\t\t};\n\t\t}else{\n\t\t\tdoh.debug = function(){\n\t\t\t\tsendToLogPane.call(window, arguments);\n\t\t\t}\n\t\t}\n\n\t\tvar loaded = false;\n\t\tvar groupTemplate = null;\n\t\tvar testTemplate = null;\n\n\t\tvar groupNodes = {};\n\n\t\tvar _groupTogglers = {};\n\n\t\tvar _getGroupToggler = function(group, toggle){\n\t\t\tif(_groupTogglers[group]){ return _groupTogglers[group]; }\n\t\t\tvar rolledUp = true;\n\t\t\treturn (_groupTogglers[group] = function(evt, forceOpen){\n\t\t\t\tvar nodes = groupNodes[group].__items;\n\t\t\t\tvar x;\n\t\t\t\tif(rolledUp||forceOpen){\n\t\t\t\t\trolledUp = false;\n\t\t\t\t\tfor(x=0; x<nodes.length; x++){\n\t\t\t\t\t\tnodes[x].style.display = \"\";\n\t\t\t\t\t}\n\t\t\t\t\ttoggle.innerHTML = \"&#9660;\";\n\t\t\t\t}else{\n\t\t\t\t\trolledUp = true;\n\t\t\t\t\tfor(x=0; x<nodes.length; x++){\n\t\t\t\t\t\tnodes[x].style.display = \"none\";\n\t\t\t\t\t}\n\t\t\t\t\ttoggle.innerHTML = \"&#9658;\";\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tvar addGroupToList = function(group){\n\t\t\tif(!byId(\"testList\")){ return; }\n\t\t\tvar tb = byId(\"testList\").tBodies[0];\n\t\t\tvar tg = groupTemplate.cloneNode(true);\n\t\t\tvar tds = tg.getElementsByTagName(\"td\");\n\t\t\tvar toggle = tds[0];\n\t\t\ttoggle.onclick = _getGroupToggler(group, toggle);\n\t\t\tvar cb = tds[1].getElementsByTagName(\"input\")[0];\n\t\t\tcb.group = group;\n\t\t\tcb.onclick = function(evt){\n\t\t\t\tdoh._groups[group].skip = (!this.checked);\n\t\t\t}\n\t\t\ttds[2].innerHTML = \"<div class='testGroupName'>\"+group+\"</div><div style='width:0;'>&nbsp;</div>\";\n\t\t\ttds[3].innerHTML = \"\";\n\n\t\t\ttb.appendChild(tg);\n\t\t\treturn tg;\n\t\t}\n\n\t\tvar addFixtureToList = function(group, fixture){\n\t\t\tif(!testTemplate){ return; }\n\t\t\tvar cgn = groupNodes[group];\n\t\t\tif(!cgn[\"__items\"]){ cgn.__items = []; }\n\t\t\tvar tn = testTemplate.cloneNode(true);\n\t\t\tvar tds = tn.getElementsByTagName(\"td\");\n\n\t\t\ttds[2].innerHTML = fixture.name;\n\t\t\ttds[3].innerHTML = \"\";\n\n\t\t\tvar nn = (cgn.__lastFixture||cgn.__groupNode).nextSibling;\n\t\t\tif(nn){\n\t\t\t\tnn.parentNode.insertBefore(tn, nn);\n\t\t\t}else{\n\t\t\t\tcgn.__groupNode.parentNode.appendChild(tn);\n\t\t\t}\n\t\t\t// FIXME: need to make group display toggleable!!\n\t\t\ttn.style.display = \"none\";\n\t\t\tcgn.__items.push(tn);\n\t\t\treturn (cgn.__lastFixture = tn);\n\t\t}\n\n\t\tvar getFixtureNode = function(group, fixture){\n\t\t\tif(groupNodes[group]){\n\t\t\t\treturn groupNodes[group][fixture.name];\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\tvar getGroupNode = function(group){\n\t\t\tif(groupNodes[group]){\n\t\t\t\treturn groupNodes[group].__groupNode;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\tvar updateBacklog = [];\n\t\tdoh._updateTestList = function(group, fixture, unwindingBacklog){\n\t\t\tif(!loaded){\n\t\t\t\tif(group && fixture){\n\t\t\t\t\tupdateBacklog.push([group, fixture]);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}else if(updateBacklog.length && !unwindingBacklog){\n\t\t\t\tvar tr;\n\t\t\t\twhile((tr=updateBacklog.shift())){\n\t\t\t\t\tdoh._updateTestList(tr[0], tr[1], true);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(group && fixture){\n\t\t\t\tif(!groupNodes[group]){\n\t\t\t\t\tgroupNodes[group] = {\n\t\t\t\t\t\t\"__groupNode\": addGroupToList(group)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif(!groupNodes[group][fixture.name]){\n\t\t\t\t\tgroupNodes[group][fixture.name] = addFixtureToList(group, fixture)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdoh._testRegistered = doh._updateTestList;\n\n\t\tdoh._groupStarted = function(group){\n\t\t\tif(this._suiteCount == 0){\n\t\t\t\tthis._runedSuite = 0;\n\t\t\t\tthis._currentGlobalProgressBarWidth = 0;\n\t\t\t\tthis._suiteCount = this._testCount;\n\t\t\t}\n\t\t\t// console.debug(\"_groupStarted\", group);\n\t\t\tif(doh._inGroup != group){\n\t\t\t\tdoh._groupTotalTime = 0;\n\t\t\t\tdoh._runed = 0;\n\t\t\t\tdoh._inGroup = group;\n\t\t\t\tthis._runedSuite++;\n\t\t\t}\n\t\t\tvar gn = getGroupNode(group);\n\t\t\tif(gn){\n\t\t\t\tgn.className = \"inProgress\";\n\t\t\t}\n\t\t}\n\n\t\tdoh._groupFinished = function(group, success){\n\t\t\t// console.debug(\"_groupFinished\", group);\n\t\t\tvar gn = getGroupNode(group);\n\t\t\tif(gn && doh._inGroup == group){\n\t\t\t\tdoh._totalTime += doh._groupTotalTime;\n\t\t\t\tgn.getElementsByTagName(\"td\")[3].innerHTML = doh._groupTotalTime+\"ms\";\n\t\t\t\tgn.getElementsByTagName(\"td\")[2].lastChild.className = \"\";\n\t\t\t\tdoh._inGroup = null;\n\t\t\t\t//doh._runedSuite++;\n\t\t\t\tvar failure = doh._updateGlobalProgressBar(this._runedSuite/this._groupCount,success,group);\n\t\t\t\tgn.className = failure ? \"failure\" : \"success\";\n\t\t\t\t//doh._runedSuite--;\n\t\t\t\tdoh._currentGlobalProgressBarWidth = parseInt(this._runedSuite/this._groupCount*10000)/100;\n\t\t\t\t//byId(\"progressOuter\").style.width = parseInt(this._runedSuite/this._suiteCount*100)+\"%\";\n\t\t\t}\n\t\t\tif(doh._inGroup == group){\n\t\t\t\tthis.debug(\"Total time for GROUP \\\"\",group,\"\\\" is \",doh._groupTotalTime,\"ms\");\n\t\t\t}\n\t\t}\n\n\t\tdoh._testStarted = function(group, fixture){\n\t\t\t// console.debug(\"_testStarted\", group, fixture.name);\n\t\t\tvar fn = getFixtureNode(group, fixture);\n\t\t\tif(fn){\n\t\t\t\tfn.className = \"inProgress\";\n\t\t\t}\n\t\t}\n\n\t\tvar _nameTimes = {};\n\t\tvar _playSound = function(name){\n\t\t\tif(byId(\"hiddenAudio\") && byId(\"audio\") && byId(\"audio\").checked){\n\t\t\t\t// console.debug(\"playing:\", name);\n\t\t\t\tvar nt = _nameTimes[name];\n\t\t\t\t// only play sounds once every second or so\n\t\t\t\tif((!nt)||(((new Date)-nt) > 700)){\n\t\t\t\t\t_nameTimes[name] = new Date();\n\t\t\t\t\tvar tc = document.createElement(\"span\");\n\t\t\t\t\tbyId(\"hiddenAudio\").appendChild(tc);\n\t\t\t\t\ttc.innerHTML = '<embed src=\"_sounds/'+name+'.wav\" autostart=\"true\" loop=\"false\" hidden=\"true\" width=\"1\" height=\"1\"></embed>';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdoh._updateGlobalProgressBar = function(p,success,group){\n\t\t\tvar outerContainer=byId(\"progressOuter\");\n\n\t\t\tvar gdiv=outerContainer.childNodes[doh._runedSuite-1];\n\t\t\tif(!gdiv){\n\t\t\t\tgdiv=document.createElement('div');\n\t\t\t\touterContainer.appendChild(gdiv);\n\t\t\t\tgdiv.className='success';\n\t\t\t\tgdiv.setAttribute('_target',group);\n\t\t\t}\n\t\t\tif(!success && !gdiv._failure){\n\t\t\t\tgdiv._failure=true;\n\t\t\t\tgdiv.className='failure';\n\t\t\t\tif(group){\n\t\t\t\t\tgdiv.setAttribute('title','failed group '+group);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar tp=parseInt(p*10000)/100;\n\t\t\tgdiv.style.width = (tp-doh._currentGlobalProgressBarWidth)+\"%\";\n\t\t\treturn gdiv._failure;\n\t\t}\n\t\tdoh._testFinished = function(group, fixture, success){\n\t\t\tvar fn = getFixtureNode(group, fixture);\n\t\t\tvar elapsed = fixture.endTime-fixture.startTime;\n\t\t\tif(fn){\n\t\t\t\tfn.getElementsByTagName(\"td\")[3].innerHTML = elapsed+\"ms\";\n\t\t\t\tfn.className = (success) ? \"success\" : \"failure\";\n\t\t\t\tfn.getElementsByTagName(\"td\")[2].setAttribute('_target', _loggedMsgLen);\n\t\t\t\tif(!success){\n\t\t\t\t\t_playSound(\"doh\");\n\t\t\t\t\tvar gn = getGroupNode(group);\n\t\t\t\t\tif(gn){\n\t\t\t\t\t\tgn.className = \"failure\";\n\t\t\t\t\t\t_getGroupToggler(group)(null, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(doh._inGroup == group){\n\t\t\t\tvar gn = getGroupNode(group);\n\t\t\t\tdoh._runed++;\n\t\t\t\tif(gn && doh._curTestCount){\n\t\t\t\t\tvar p = doh._runed/doh._curTestCount;\n\t\t\t\t\tvar groupfail = this._updateGlobalProgressBar((doh._runedSuite+p-1)/doh._groupCount,success,group);\n\n\t\t\t\t\tvar pbar = gn.getElementsByTagName(\"td\")[2].lastChild;\n\t\t\t\t\tpbar.className = groupfail?\"failure\":\"success\";\n\t\t\t\t\tpbar.style.width = parseInt(p*100)+\"%\";\n\t\t\t\t\tgn.getElementsByTagName(\"td\")[3].innerHTML = parseInt(p*10000)/100+\"%\";\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._groupTotalTime += elapsed;\n\t\t\tthis.debug((success ? \"PASSED\" : \"FAILED\"), \"test:\", fixture.name, elapsed, 'ms');\n\t\t}\n\n\t\t// FIXME: move implementation to _browserRunner?\n\t\tdoh.registerUrl = function(\t/*String*/ group,\n\t\t\t\t\t\t\t\t\t\t/*String*/ url,\n\t\t\t\t\t\t\t\t\t\t/*Integer*/ timeout){\n\t\t\tvar tg = new String(group);\n\t\t\tthis.register(group, {\n\t\t\t\tname: url,\n\t\t\t\tsetUp: function(){\n\t\t\t\t\tdoh.currentGroupName = tg;\n\t\t\t\t\tdoh.currentGroup = this;\n\t\t\t\t\tdoh.currentUrl = url;\n\t\t\t\t\tthis.d = new doh.Deferred();\n\t\t\t\t\tdoh.currentTestDeferred = this.d;\n\t\t\t\t\tdoh.showTestPage();\n\t\t\t\t\tbyId(\"testBody\").src = url;\n\t\t\t\t},\n\t\t\t\ttimeout: timeout||10000, // 10s\n\t\t\t\t// timeout: timeout||1000, // 10s\n\t\t\t\trunTest: function(){\n\t\t\t\t\t// FIXME: implement calling into the url's groups here!!\n\t\t\t\t\treturn this.d;\n\t\t\t\t},\n\t\t\t\ttearDown: function(){\n\t\t\t\t\tdoh.currentGroupName = null;\n\t\t\t\t\tdoh.currentGroup = null;\n\t\t\t\t\tdoh.currentTestDeferred = null;\n\t\t\t\t\tdoh.currentUrl = null;\n\t\t\t\t\t// this.d.errback(false);\n\t\t\t\t\t// byId(\"testBody\").src = \"about:blank\";\n\t\t\t\t\tdoh.showLogPage();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t//\n\t\t// Utility code for runner.html\n\t\t//\n\t\t// var isSafari = navigator.appVersion.indexOf(\"Safari\") >= 0;\n\t\tvar tabzidx = 1;\n\t\tvar _showTab = function(toShow, toHide){\n\t\t\t// FIXME: I don't like hiding things this way.\n\t\t\tvar i;\n\t\t\tfor(i = 0; i < toHide.length; i++){\n\t\t\t\tvar node = byId(toHide[i]);\n\t\t\t\tif(node){\n\t\t\t\t\tnode.style.display=\"none\";\n\t\t\t\t}\n\t\t\t}\n\t\t\ttoShow = byId(toShow);\n\t\t\tif(toShow){\n\t\t\t\twith(toShow.style){\n\t\t\t\t\tdisplay = \"\";\n\t\t\t\t\tzIndex = ++tabzidx;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdoh.showTestPage = function(){\n\t\t\t_showTab(\"testBody\", [\"logBody\", \"perfTestsBody\"]);\n\t\t}\n\n\t\tdoh.showLogPage = function(){\n\t\t\t_showTab(\"logBody\", [\"testBody\", \"perfTestsBody\"]);\n\t\t}\n\n\t\tdoh.showPerfTestsPage = function(){\n\t\t\t_showTab(\"perfTestsBody\", [\"testBody\", \"logBody\"]);\n\t\t}\n\n\t\tvar runAll = true;\n\t\tdoh.toggleRunAll = function(){\n\t\t\t// would be easier w/ query...sigh\n\t\t\trunAll = !runAll;\n\t\t\tif(!byId(\"testList\")){ return; }\n\t\t\tvar tb = byId(\"testList\").tBodies[0];\n\t\t\tvar inputs = tb.getElementsByTagName(\"input\");\n\t\t\tvar x=0; var tn;\n\t\t\twhile((tn=inputs[x++])){\n\t\t\t\ttn.checked = runAll;\n\t\t\t\tdoh._groups[tn.group].skip = (!runAll);\n\t\t\t}\n\t\t}\n\n\t\tvar listHeightTimer = null;\n\t\tvar setListHeight = function(){\n\t\t\tif(listHeightTimer){\n\t\t\t\tclearTimeout(listHeightTimer);\n\t\t\t}\n\t\t\tvar tl = byId(\"testList\");\n\t\t\tif(!tl){ return; }\n\t\t\tlistHeightTimer = doh.setTimeout(function(){\n\t\t\t\ttl.style.display = \"none\";\n\t\t\t\ttl.style.display = \"\";\n\n\t\t\t}, 10);\n\t\t}\n\n\t\t_addOnEvt(\"resize\", setListHeight);\n\t\t_addOnEvt(\"load\", setListHeight);\n\t\t_addOnEvt(\"load\", function(){\n\t\t\tif(loaded){ return; }\n\t\t\tloaded = true;\n\t\t\tgroupTemplate = byId(\"groupTemplate\");\n\t\t\tif(!groupTemplate){\n\t\t\t\t// make sure we've got an ammenable DOM structure\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgroupTemplate.parentNode.removeChild(groupTemplate);\n\t\t\tgroupTemplate.style.display = \"\";\n\t\t\ttestTemplate = byId(\"testTemplate\");\n\t\t\ttestTemplate.parentNode.removeChild(testTemplate);\n\t\t\ttestTemplate.style.display = \"\";\n\t\t\tdoh._updateTestList();\n\t\t});\n\n\t\t_addOnEvt(\"load\",\n\t\t\tfunction(){\n\t\t\t\t// let robot code run if it gets to this first\n\t\t\t\tvar __onEnd = doh._onEnd;\n\t\t\t\tdoh._onEnd = function(){\n\t\t\t\t\t__onEnd.apply(doh, arguments);\n\t\t\t\t\tif(doh._failureCount == 0){\n\t\t\t\t\t\tdoh.debug(\"WOOHOO!!\");\n\t\t\t\t\t\t_playSound(\"woohoo\");\n\t\t\t\t\t}else{\n\t\t\t\t\t\tconsole.debug(\"doh._failureCount:\", doh._failureCount);\n\t\t\t\t\t}\n\t\t\t\t\tif(byId(\"play\")){\n\t\t\t\t\t\ttoggleRunning();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!byId(\"play\")){\n\t\t\t\t\t// make sure we've got an amenable DOM structure\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar isRunning = false;\n\t\t\t\tvar toggleRunning = function(){\n\t\t\t\t\t// ugg, this would be so much better w/ dojo.query()\n\t\t\t\t\tif(isRunning){\n\t\t\t\t\t\tbyId(\"play\").style.display = byId(\"pausedMsg\").style.display = \"\";\n\t\t\t\t\t\tbyId(\"playingMsg\").style.display = byId(\"pause\").style.display = \"none\";\n\t\t\t\t\t\tisRunning = false;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tbyId(\"play\").style.display = byId(\"pausedMsg\").style.display = \"none\";\n\t\t\t\t\t\tbyId(\"playingMsg\").style.display = byId(\"pause\").style.display = \"\";\n\t\t\t\t\t\tisRunning = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdoh.run = (function(oldRun){\n\t\t\t\t\treturn function(){\n\t\t\t\t\t\tif(!doh._currentGroup){\n\t\t\t\t\t\t\ttoggleRunning();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn oldRun.apply(doh, arguments);\n\t\t\t\t\t}\n\t\t\t\t})(doh.run);\n\t\t\t\tvar btns = byId(\"toggleButtons\").getElementsByTagName(\"span\");\n\t\t\t\tvar node; var idx=0;\n\t\t\t\twhile((node=btns[idx++])){\n\t\t\t\t\tnode.onclick = toggleRunning;\n\t\t\t\t}\n\n\t\t\t\t//Performance report generating functions!\n\t\t\t\tdoh._dojoPlotPerfResults = function(div, name, dataArray) {\n\t\t\t\t\tvar median = doh.median(dataArray);\n\t\t\t\t\tvar medarray = [];\n\n\t\t\t\t\tvar i;\n\t\t\t\t\tfor(i = 0; i < dataArray.length; i++){\n\t\t\t\t\t\tmedarray.push(median);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar data = {\n\t\t\t\t\t\tlabel: \"name\",\n\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t{name: name, trials: dataArray},\n\t\t\t\t\t\t\t{name: \"Median\", trials: medarray}\n\t\t\t\t\t\t]\n\t\t\t\t\t};\n\t\t\t\t\tvar ifs = new dojo.data.ItemFileReadStore({data: data});\n\n\t\t\t\t\tvar min = Math.floor(doh.min(dataArray));\n\t\t\t\t\tvar max = Math.ceil(doh.max(dataArray));\n\t\t\t\t\tvar step = (max - min)/10;\n\n\t\t\t\t\t//Lets try to pad out the bottom and top a bit\n\t\t\t\t\t//Then recalc the step.\n\t\t\t\t\tif(min > 0){\n\t\t\t\t\t\tmin = min - step;\n\t\t\t\t\t\tif(min < 0){\n\t\t\t\t\t\t\tmin = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin = Math.floor(min);\n\t\t\t\t\t}\n\t\t\t\t\tif(max > 0){\n\t\t\t\t\t\tmax = max + step;\n\t\t\t\t\t\tmax = Math.ceil(max);\n\t\t\t\t\t}\n\t\t\t\t\tstep = (max - min)/10;\n\n\t\t\t\t\tvar chart = new dojox.charting.DataChart(div, {\n\t\t\t\t\t\ttype: dojox.charting.plot2d.Lines,\n\t\t\t\t\t\tdisplayRange:dataArray.length,\n\t\t\t\t\t\txaxis: {min: 1, max: dataArray.length, majorTickStep: Math.ceil((dataArray.length - 1)/10), htmlLabels: false},\n\t\t\t\t\t\tyaxis: {min: min, max: max, majorTickStep: step, vertical: true, htmlLabels: false}\n\t\t\t\t\t});\n\t\t\t\t\tchart.setStore(ifs, {name:\"*\"}, \"trials\");\n\t\t\t\t};\n\n\t\t\t\tdoh._asciiPlotPerfResults = function(){\n\t\t\t\t\t//TODO:  Implement!\n\t\t\t\t};\n\t\t\t}\n\t\t);\n\t}else{\n\t\t// we're in an iframe environment. Time to mix it up a bit.\n\n\t\t_doh = window.parent.doh;\n\t\tvar _thisGroup = _doh.currentGroupName;\n\t\tvar _thisUrl = _doh.currentUrl;\n\t\tif(_thisGroup){\n\t\t\tdoh._testRegistered = function(group, tObj){\n\t\t\t\t_doh._updateTestList(_thisGroup, tObj);\n\t\t\t}\n\t\t\tdoh._onEnd = function(){\n\t\t\t\t_doh._errorCount += doh._errorCount;\n\t\t\t\t_doh._failureCount += doh._failureCount;\n\t\t\t\t_doh._testCount += doh._testCount;\n\t\t\t\t// should we be really adding raw group counts?\n\t\t\t\t//_doh._groupCount += doh._groupCount;\n\t\t\t\t_doh.currentTestDeferred.callback(true);\n\t\t\t}\n\t\t\tvar otr = doh._getTestObj;\n\t\t\tdoh._getTestObj = function(){\n\t\t\t\tvar tObj = otr.apply(doh, arguments);\n\t\t\t\ttObj.name = _thisUrl+\"::\"+arguments[0]+\"::\"+tObj.name;\n\t\t\t\treturn tObj;\n\t\t\t}\n\t\t\tdoh.debug = doh.hitch(_doh, \"debug\");\n\t\t\tdoh.registerUrl = doh.hitch(_doh, \"registerUrl\");\n\t\t\tdoh._testStarted = function(group, fixture){\n\t\t\t\t_doh._testStarted(_thisGroup, fixture);\n\t\t\t}\n\t\t\tdoh._testFinished = function(g, f, s){\n\t\t\t\t_doh._testFinished(_thisGroup, f, s);\n\n\t\t\t\t//Okay, there may be performance info we need to filter back\n\t\t\t\t//to the parent, so do that here.\n\t\t\t\tif(doh.perfTestResults){\n\t\t\t\t\ttry{\n\t\t\t\t\t\tgName = g.toString();\n\t\t\t\t\t\tvar localFName = f.name;\n\t\t\t\t\t\twhile(localFName.indexOf(\"::\") >= 0){\n\t\t\t\t\t\t\tlocalFName = localFName.substring(localFName.indexOf(\"::\") + 2, localFName.length);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!_doh.perfTestResults){\n\t\t\t\t\t\t\t_doh.perfTestResults = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!_doh.perfTestResults[gName]){\n\t\t\t\t\t\t\t_doh.perfTestResults[gName] = {};\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_doh.perfTestResults[gName][f.name] = doh.perfTestResults[gName][localFName];\n\t\t\t\t\t}catch (e){\n\t\t\t\t\t\tdoh.debug(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdoh._groupStarted = function(g){\n\t\t\t\tif(!this._setParent){\n\t\t\t\t\t_doh._curTestCount = this._testCount;\n\t\t\t\t\t_doh._curGroupCount = this._groupCount;\n\t\t\t\t\tthis._setParent = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdoh._report = function(){\n\t\t\t};\n\t\t}\n\t}\n\n})();\n"
  },
  {
    "path": "tests/doh/_nodeRunner.js",
    "content": "\n/*global doh: false, process: false */\n\nvar aps = Array.prototype.slice;\n\ndoh.debug = function () {\n    //Could have multiple args, join them all together.\n    var msg = aps.call(arguments, 0).join(' ');\n    console.log(msg);\n};\n\n// Override the doh._report method to make it quit with an\n// appropriate exit code in case of test failures.\nvar oldReport = doh._report;\ndoh._report = function () {\n    oldReport.apply(doh, arguments);\n    if (this._failureCount > 0 || this._errorCount > 0) {\n        process.exit(1);\n    }\n};\n"
  },
  {
    "path": "tests/doh/_rhinoRunner.js",
    "content": "if(this[\"dojo\"]){\n\tdojo.provide(\"doh._rhinoRunner\");\n}\n\ndoh.debug = print;\n\n// Override the doh._report method to make it quit with an \n// appropriate exit code in case of test failures.\n(function(){\n\tvar oldReport = doh._report;\n\tdoh._report = function(){\n\t\toldReport.apply(doh, arguments);\n\t\tif(this._failureCount > 0 || this._errorCount > 0){\n\t\t\tquit(1);\n\t\t}\n\t}\n})();\n"
  },
  {
    "path": "tests/doh/_sounds/LICENSE",
    "content": "License Disclaimer:\n\nAll contents of this directory are Copyright (c) the Dojo Foundation, with the\nfollowing exceptions:\n-------------------------------------------------------------------------------\n\nwoohoo.wav, doh.wav, dohaaa.wav:\n\t* Copyright original authors.\n\t  Copied from:\n\t  \thttp://simpson-homer.com/homer-simpson-soundboard.html\n"
  },
  {
    "path": "tests/doh/runner.html",
    "content": "<html>\n\t<!--\n\t\tNOTE: we are INTENTIONALLY in quirks mode. It makes it much easier to\n\t\tget a \"full screen\" UI w/ straightforward CSS.\n\t-->\n\t<!--\n\t\t// TODO: provide a UI for prompted tests\n\t-->\n\t<head>\n\t\t<title>alameda Tests Via The Dojo Unit Test Harness, $Rev: 20149 $</title>\n\n\t\t<script type=\"text/javascript\">\n\t\t\t// workaround for bug in Safari 3.  See #7189\n\t\t\tif (/3[\\.0-9]+ Safari/.test(navigator.appVersion))\n\t\t\t{\n\t\t\t\twindow.console = {\n\t\t\t\t    origConsole: window.console,\n\t\t\t\t    log: function(s){\n\t\t\t\t\t\tthis.origConsole.log(s);\n\t\t\t\t\t},\n\t\t\t\t\tinfo: function(s){\n\t\t\t\t\t\tthis.origConsole.info(s);\n\t\t\t\t\t},\n\t\t\t\t\terror: function(s){\n\t\t\t\t\t\tthis.origConsole.error(s);\n\t\t\t\t\t},\n\t\t\t\t\twarn: function(s){\n\t\t\t\t\t\tthis.origConsole.warn(s);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t</script>\n\n\t\t<script type=\"text/javascript\">\n\t\t\twindow.dojoUrl = \"../../dojo/dojo.js\";\n\t\t\twindow.testUrl = \"\";\n\t\t\twindow.testModule = \"\";\n\n\t\t\t// parse out our test URL and our Dojo URL from the query string\n\t\t\tvar qstr = window.location.search.substr(1);\n\t\t\tif(qstr.length){\n\t\t\t\tvar qparts = qstr.split(\"&\");\n\t\t\t\tfor(var x=0; x<qparts.length; x++){\n\t\t\t\t\tvar tp = qparts[x].split(\"=\");\n\t\t\t\t\tif(tp[0] == \"dojoUrl\"){\n\t\t\t\t\t\twindow.dojoUrl = tp[1];\n\t\t\t\t\t}\n\t\t\t\t\tif(tp[0] == \"testUrl\"){\n\t\t\t\t\t\twindow.testUrl = tp[1];\n\t\t\t\t\t}\n\t\t\t\t\tif(tp[0] == \"testModule\"){\n\t\t\t\t\t\twindow.testModule = tp[1];\n\t\t\t\t\t}\n\t\t\t\t\tif(tp[0] == \"registerModulePath\"){\n\t\t\t\t\t\tvar modules = tp[1].split(\";\");\n\t\t\t\t\t\twindow.registerModulePath=[];\n\t\t\t\t\t\tfor (var i=0; i<modules.length;i++){\n\t\t\t\t\t\t\twindow.registerModulePath.push(modules[i].split(\",\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//document.write(\"<scr\"+\"ipt type='text/javascript' djConfig='isDebug: true' src='\"+dojoUrl+\"'></scr\"+\"ipt>\");\n\t\t</script>\n\t\t<script type=\"text/javascript\" src=\"runner.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"_browserRunner.js\"></script>\n\n\t\t<script type=\"text/javascript\">\n\t\t\tif(testUrl.length){\n\t\t\t\tdocument.write(\"<scr\"+\"ipt type='text/javascript' src='\"+testUrl+\".js'></scr\"+\"ipt>\");\n\t\t\t}\n\t\t</script>\n\t\t<style type=\"text/css\">\n\t\t\t/* @import \"../../dojo/resources/dojo.css\"; */\n\t\t\t/*\n\t\t\tbody {\n\t\t\t\tmargin: 0px;\n\t\t\t\tpadding: 0px;\n\t\t\t\tfont-size: 13px;\n\t\t\t\tcolor: #292929;\n\t\t\t\tfont-family: Myriad, Lucida Grande, Bitstream Vera Sans, Arial, Helvetica, sans-serif;\n\t\t\t\t*font-size: small;\n\t\t\t\t*font: x-small;\n\t\t\t}\n\n\t\t\tth, td {\n\t\t\t\tfont-size: 13px;\n\t\t\t\tcolor: #292929;\n\t\t\t\tfont-family: Myriad, Lucida Grande, Bitstream Vera Sans, Arial, Helvetica, sans-serif;\n\t\t\t\tfont-weight: normal;\n\t\t\t}\n\n\t\t\t* body {\n\t\t\t\tline-height: 1.25em;\n\t\t\t}\n\n\t\t\ttable {\n\t\t\t\tborder-collapse: collapse;\n\t\t\t}\n\t\t\t*/\n\n\t\t\t#testLayout {\n\t\t\t\tposition: relative;\n\t\t\t\tleft: 0px;\n\t\t\t\ttop: 0px;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\tborder: 1px solid black;\n\t\t\t\tborder: 0px;\n\t\t\t}\n\n\t\t\t.tabBody {\n\t\t\t\tmargin: 0px;\n\t\t\t\tpadding: 0px;\n\t\t\t\t/*\n\t\t\t\tborder: 1px solid black;\n\t\t\t\t*/\n\t\t\t\tbackground-color: #DEDEDE;\n\t\t\t\tborder: 0px;\n\t\t\t\twidth: 100%;\n\t\t\t\theight: 100%;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0px;\n\t\t\t\ttop: 0px;\n\t\t\t\toverflow: auto;\n\t\t\t}\n\n\t\t\t#logBody {\n\t\t\t\tpadding-left: 5px;\n\t\t\t\tpadding-top: 5px;\n\t\t\t\tfont-family: Monaco, monospace;\n\t\t\t\tfont-size: 11px;\n\t\t\t\twhite-space: pre;\n\t\t\t}\n\n\t\t\t#progressOuter {\n\t\t\t\tbackground:#e9e9e9 url(\"http://o.aolcdn.com/dojo/1.3/dijit/themes/tundra/images/dojoTundraGradientBg.png\") repeat-x 0 0;\n\t\t\t\theight: 1em;\n\t\t\t\t/*the following trick is necessary to prevent IE from wrapping the last piece of progress bar into a new line*/\n\t\t\t\t_margin:1px;\n\t\t\t\t_padding: -1px;\n\n\t\t\t\t/*\n\t\t\t\tborder-color: #e8e8e8;\n\t\t\t\t*/\n\t\t\t}\n\n\t\t\t#progressOuter .success, #progressOuter .failure{\n\t\t\t\tfloat: left;\n\t\t\t\theight: 1em;\n\t\t\t}\n\n\t\t\t#play, #pause {\n\t\t\t\tfont-family: Arial;\n\t\t\t\tfont-size: 1.4em;\n\t\t\t\tborder: 1px solid #DEDEDE;\n\t\t\t\tcursor: pointer;\n\t\t\t\tpadding-right: 0.5em;\n\t\t\t}\n\n\t\t\t.header {\n\t\t\t\tborder: 1px solid #DEDEDE;\n\t\t\t}\n\n\t\t\tbutton.tab {\n\t\t\t\tborder-width: 1px 1px 0px 1px;\n\t\t\t\tborder-style: solid;\n\t\t\t\tborder-color: #DEDEDE;\n\t\t\t\tmargin-right: 5px;\n\t\t\t}\n\n\t\t\t#testListContainer {\n\t\t\t\t/*\n\t\t\t\tborder: 1px solid black;\n\t\t\t\t*/\n\t\t\t\tposition: relative;\n\t\t\t\theight: 99%;\n\t\t\t\twidth: 100%;\n\t\t\t\toverflow: auto;\n\t\t\t}\n\n\t\t\t#testList {\n\t\t\t\tborder-collapse: collapse;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 0px;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\n\t\t\t#testList td {\n\t\t\t\tborder-bottom: 1px solid #DEDEDE;\n\t\t\t\tborder-right : 1px solid #DEDEDE;\n\t\t\t\tpadding: 3px;\n\t\t\t}\n\n\t\t\t#testListHeader th {\n\t\t\t\tborder-bottom: 1px solid #DEDEDE;\n\t\t\t\tborder-right : 1px solid #DEDEDE;\n\t\t\t\tpadding: 3px;\n\t\t\t\tfont-weight: bolder;\n\t\t\t\tfont-style: italic;\n\t\t\t}\n\n\t\t\t#testList tfoot {\n\t\t\t\tfont-weight: bold;\n\t\t\t}\n\n\t\t\t#toggleButtons {\n\t\t\t\tfloat: left;\n\t\t\t\tbackground-color: #DEDEDE;\n\t\t\t}\n\n\t\t\tdiv.testGroupName {\n\t\t\t\tposition: absolute;\n\t\t\t}\n\n\t\t\t.inProgress {\n\t\t\t\tbackground-color: #85afde;\n\t\t\t}\n\n\t\t\t.success {\n\t\t\t\tbackground-color: #7cdea7;\n\t\t\t}\n\n\t\t\t.failure {\n\t\t\t\tbackground-color: #de827b;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<table id=\"testLayout\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin: 0;\">\n\t\t\t<tr valign=\"top\" height=\"40\">\n\t\t\t\t<td colspan=\"2\" id=\"logoBar\">\n\t\t\t\t\t<h3 style=\"margin: 5px 5px 0px 5px; float: left;\">alameda Tests Via D.O.H.: The Dojo Objective Harness</h3>\n\t\t\t\t\t<img src=\"small_logo.png\" height=\"40\" style=\"margin: 0px 5px 0px 5px; float: right;\">\n\t\t\t\t\t<span style=\"margin: 10px 5px 0px 5px; float: right;\">\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"audio\" name=\"audio\">\n\t\t\t\t\t\t<label for=\"audio\">sounds?</label>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr valign=\"top\" height=\"10\">\n\t\t\t\t<td colspan=\"2\"><div id=\"progressOuter\" onclick=\"doh._jumpToSuite(arguments[0]);\"></div></td>\n\t\t\t</tr>\n\t\t\t<tr valign=\"top\" height=\"30\">\n\t\t\t\t<td width=\"30%\" class=\"header\">\n\t\t\t\t\t<span id=\"toggleButtons\" onclick=\"doh.togglePaused();\">\n\t\t\t\t\t\t<button id=\"play\">&#9658;</button>\n\t\t\t\t\t\t<button id=\"pause\" style=\"display: none;\">&#9553;</button>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span id=\"runningStatus\">\n\t\t\t\t\t\t<span id=\"pausedMsg\">Stopped</span>\n\t\t\t\t\t\t<span id=\"playingMsg\" style=\"display: none;\">Tests Running</span>\n\t\t\t\t\t</span>\n\t\t\t\t</td>\n\t\t\t\t<td width=\"*\" class=\"header\" valign=\"bottom\">\n\t\t\t\t\t<button class=\"tab\" onclick=\"doh.showTestPage();\">Test Page</button>\n\t\t\t\t\t<button class=\"tab\" onclick=\"doh.showLogPage();\">Log</button>\n                    <button class=\"tab\" onclick=\"doh.showPerfTestsPage();\">Performance Tests Results</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr valign=\"top\" style=\"border: 0; padding: 0; margin: 0;\">\n\t\t\t\t<td height=\"100%\" style=\"border: 0; padding: 0; margin: 0;\">\n\t\t\t\t\t<div id=\"testListContainer\">\n\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"\n\t\t\t\t\t\t\twidth=\"100%\" id=\"testList\" style=\"margin: 0;\" onclick=\"doh._jumpToLog(arguments[0]);\">\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr id=\"testListHeader\" style=\"border: 0; padding: 0; margin: 0;\" >\n\t\t\t\t\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t\t\t\t\t<th width=\"20\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" checked\n\t\t\t\t\t\t\t\t\t\t\tonclick=\"doh.toggleRunAll();\">\n\t\t\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t\t\t<th width=\"*\" style=\"text-align: left;\">test</th>\n\t\t\t\t\t\t\t\t\t<th width=\"50\">time</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody valign=\"top\">\n\t\t\t\t\t\t\t\t<tr id=\"groupTemplate\" style=\"display: none;\">\n\t\t\t\t\t\t\t\t\t<td style=\"font-family: Arial; width: 15px;\">&#9658;</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" checked>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t<td>group name</td>\n\t\t\t\t\t\t\t\t\t<td>10ms</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr id=\"testTemplate\" style=\"display: none;\">\n\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t\t\t\t\t<td style=\"padding-left: 20px;\">test name</td>\n\t\t\t\t\t\t\t\t\t<td>10ms</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<div style=\"position: relative; width: 99%; height: 100%; top: 0px; left: 0px;\">\n\t\t\t\t\t\t<div class=\"tabBody\"\n\t\t\t\t\t\t\tstyle=\"z-index: 1;\">\n\t\t\t\t\t\t\t<pre id=\"logBody\"></pre>\n\t\t\t\t\t\t\t<div id=\"perfTestsBody\" style=\"background-color: white;\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<iframe id=\"testBody\" class=\"tabBody\"\n\t\t\t\t\t\t\tstyle=\"z-index: -1;\"></iframe>\n\t\t\t\t\t\t<!--\n\t\t\t\t\t\t\tsrc=\"http://redesign.dojotoolkit.org\"></iframe>\n\t\t\t\t\t\t-->\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<span id=\"hiddenAudio\"></span>\n\t</body>\n</html>\n\n"
  },
  {
    "path": "tests/doh/runner.js",
    "content": "// package system gunk.\n//try{\n//\tdojo.provide(\"doh.runner\");\n//}catch(e){\n\tif(!this[\"doh\"]){\n\t\tdoh = {};\n\t}\n//}\n\n//\n// Utility Functions and Classes\n//\n\ndoh.selfTest = false;\n\ndoh.global = this;\n\ndoh.hitch = function(/*Object*/thisObject, /*Function|String*/method /*, ...*/){\n\tvar args = [];\n\tfor(var x=2; x<arguments.length; x++){\n\t\targs.push(arguments[x]);\n\t}\n\tvar fcn = ((typeof method == \"string\") ? thisObject[method] : method) || function(){};\n\treturn function(){\n\t\tvar ta = args.concat([]); // make a copy\n\t\tfor(var x=0; x<arguments.length; x++){\n\t\t\tta.push(arguments[x]);\n\t\t}\n\t\treturn fcn.apply(thisObject, ta); // Function\n\t};\n}\n\ndoh._mixin = function(/*Object*/ obj, /*Object*/ props){\n\t// summary:\n\t//\t\tAdds all properties and methods of props to obj. This addition is\n\t//\t\t\"prototype extension safe\", so that instances of objects will not\n\t//\t\tpass along prototype defaults.\n\tvar tobj = {};\n\tfor(var x in props){\n\t\t// the \"tobj\" condition avoid copying properties in \"props\"\n\t\t// inherited from Object.prototype.  For example, if obj has a custom\n\t\t// toString() method, don't overwrite it with the toString() method\n\t\t// that props inherited from Object.protoype\n\t\tif(tobj[x] === undefined || tobj[x] != props[x]){\n\t\t\tobj[x] = props[x];\n\t\t}\n\t}\n\t// IE doesn't recognize custom toStrings in for..in\n\tif(\tthis[\"document\"]\n\t\t&& document.all\n\t\t&& (typeof props[\"toString\"] == \"function\")\n\t\t&& (props[\"toString\"] != obj[\"toString\"])\n\t\t&& (props[\"toString\"] != tobj[\"toString\"])\n\t){\n\t\tobj.toString = props.toString;\n\t}\n\treturn obj; // Object\n}\n\ndoh.mixin = function(/*Object*/obj, /*Object...*/props){\n\t// summary:\tAdds all properties and methods of props to obj.\n\tfor(var i=1, l=arguments.length; i<l; i++){\n\t\tdoh._mixin(obj, arguments[i]);\n\t}\n\treturn obj; // Object\n}\n\ndoh.extend = function(/*Object*/ constructor, /*Object...*/ props){\n\t// summary:\n\t//\t\tAdds all properties and methods of props to constructor's\n\t//\t\tprototype, making them available to all instances created with\n\t//\t\tconstructor.\n\tfor(var i=1, l=arguments.length; i<l; i++){\n\t\tdoh._mixin(constructor.prototype, arguments[i]);\n\t}\n\treturn constructor; // Object\n}\n\n\ndoh._line = \"------------------------------------------------------------\";\n\n/*\ndoh._delegate = function(obj, props){\n\t// boodman-crockford delegation\n\tfunction TMP(){};\n\tTMP.prototype = obj;\n\tvar tmp = new TMP();\n\tif(props){\n\t\tdojo.lang.mixin(tmp, props);\n\t}\n\treturn tmp;\n}\n*/\n\ndoh.debug = function(){\n\t// summary:\n\t//\t\ttakes any number of arguments and sends them to whatever debugging\n\t//\t\tor logging facility is available in this environment\n\n\t// YOUR TEST RUNNER NEEDS TO IMPLEMENT THIS\n}\n\ndoh._AssertFailure = function(msg, hint){\n\t// idea for this as way of dis-ambiguating error types is from JUM.\n\t// The JUM is dead! Long live the JUM!\n\n\tif(!(this instanceof doh._AssertFailure)){\n\t\treturn new doh._AssertFailure(msg, hint);\n\t}\n\tif(hint){\n\t\tmsg = (new String(msg||\"\"))+\" with hint: \\n\\t\\t\"+(new String(hint)+\"\\n\");\n\t}\n\tthis.message = new String(msg||\"\");\n\treturn this;\n}\ndoh._AssertFailure.prototype = new Error();\ndoh._AssertFailure.prototype.constructor = doh._AssertFailure;\ndoh._AssertFailure.prototype.name = \"doh._AssertFailure\";\n\ndoh.Deferred = function(canceller){\n\tthis.chain = [];\n\tthis.id = this._nextId();\n\tthis.fired = -1;\n\tthis.paused = 0;\n\tthis.results = [null, null];\n\tthis.canceller = canceller;\n\tthis.silentlyCancelled = false;\n};\n\ndoh.extend(doh.Deferred, {\n\tgetTestErrback: function(cb, scope){\n\t\t// summary: Replaces outer getTextCallback's in nested situations to avoid multiple callback(true)'s\n\t\tvar _this = this;\n\t\treturn function(){\n\t\t\ttry{\n\t\t\t\tcb.apply(scope||doh.global||_this, arguments);\n\t\t\t}catch(e){\n\t\t\t\t_this.errback(e);\n\t\t\t}\n\t\t};\n\t},\n\n\tgetTestCallback: function(cb, scope){\n\t\tvar _this = this;\n\t\treturn function(){\n\t\t\ttry{\n\t\t\t\tcb.apply(scope||doh.global||_this, arguments);\n\t\t\t}catch(e){\n\t\t\t\t_this.errback(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t_this.callback(true);\n\t\t};\n\t},\n\n\tgetFunctionFromArgs: function(){\n\t\tvar a = arguments;\n\t\tif((a[0])&&(!a[1])){\n\t\t\tif(typeof a[0] == \"function\"){\n\t\t\t\treturn a[0];\n\t\t\t}else if(typeof a[0] == \"string\"){\n\t\t\t\treturn doh.global[a[0]];\n\t\t\t}\n\t\t}else if((a[0])&&(a[1])){\n\t\t\treturn doh.hitch(a[0], a[1]);\n\t\t}\n\t\treturn null;\n\t},\n\n\tmakeCalled: function() {\n\t\tvar deferred = new doh.Deferred();\n\t\tdeferred.callback();\n\t\treturn deferred;\n\t},\n\n\t_nextId: (function(){\n\t\tvar n = 1;\n\t\treturn function(){ return n++; };\n\t})(),\n\n\tcancel: function(){\n\t\tif(this.fired == -1){\n\t\t\tif (this.canceller){\n\t\t\t\tthis.canceller(this);\n\t\t\t}else{\n\t\t\t\tthis.silentlyCancelled = true;\n\t\t\t}\n\t\t\tif(this.fired == -1){\n\t\t\t\tthis.errback(new Error(\"Deferred(unfired)\"));\n\t\t\t}\n\t\t}else if(this.fired == 0 &&\n\t\t\t\t\t(this.results[0] instanceof doh.Deferred)){\n\t\t\tthis.results[0].cancel();\n\t\t}\n\t},\n\n\n\t_pause: function(){\n\t\tthis.paused++;\n\t},\n\n\t_unpause: function(){\n\t\tthis.paused--;\n\t\tif ((this.paused == 0) && (this.fired >= 0)) {\n\t\t\tthis._fire();\n\t\t}\n\t},\n\n\t_continue: function(res){\n\t\tthis._resback(res);\n\t\tthis._unpause();\n\t},\n\n\t_resback: function(res){\n\t\tthis.fired = ((res instanceof Error) ? 1 : 0);\n\t\tthis.results[this.fired] = res;\n\t\tthis._fire();\n\t},\n\n\t_check: function(){\n\t\tif(this.fired != -1){\n\t\t\tif(!this.silentlyCancelled){\n\t\t\t\tthrow new Error(\"already called!\");\n\t\t\t}\n\t\t\tthis.silentlyCancelled = false;\n\t\t\treturn;\n\t\t}\n\t},\n\n\tcallback: function(res){\n\t\tthis._check();\n\t\tthis._resback(res);\n\t},\n\n\terrback: function(res){\n\t\tthis._check();\n\t\tif(!(res instanceof Error)){\n\t\t\tres = new Error(res);\n\t\t}\n\t\tthis._resback(res);\n\t},\n\n\taddBoth: function(cb, cbfn){\n\t\tvar enclosed = this.getFunctionFromArgs(cb, cbfn);\n\t\tif(arguments.length > 2){\n\t\t\tenclosed = doh.hitch(null, enclosed, arguments, 2);\n\t\t}\n\t\treturn this.addCallbacks(enclosed, enclosed);\n\t},\n\n\taddCallback: function(cb, cbfn){\n\t\tvar enclosed = this.getFunctionFromArgs(cb, cbfn);\n\t\tif(arguments.length > 2){\n\t\t\tenclosed = doh.hitch(null, enclosed, arguments, 2);\n\t\t}\n\t\treturn this.addCallbacks(enclosed, null);\n\t},\n\n\taddErrback: function(cb, cbfn){\n\t\tvar enclosed = this.getFunctionFromArgs(cb, cbfn);\n\t\tif(arguments.length > 2){\n\t\t\tenclosed = doh.hitch(null, enclosed, arguments, 2);\n\t\t}\n\t\treturn this.addCallbacks(null, enclosed);\n\t},\n\n\taddCallbacks: function(cb, eb){\n\t\tthis.chain.push([cb, eb]);\n\t\tif(this.fired >= 0){\n\t\t\tthis._fire();\n\t\t}\n\t\treturn this;\n\t},\n\n\t_fire: function(){\n\t\tvar chain = this.chain;\n\t\tvar fired = this.fired;\n\t\tvar res = this.results[fired];\n\t\tvar self = this;\n\t\tvar cb = null;\n\t\twhile(chain.length > 0 && this.paused == 0){\n\t\t\t// Array\n\t\t\tvar pair = chain.shift();\n\t\t\tvar f = pair[fired];\n\t\t\tif(f == null){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tres = f(res);\n\t\t\t\tfired = ((res instanceof Error) ? 1 : 0);\n\t\t\t\tif(res instanceof doh.Deferred){\n\t\t\t\t\tcb = function(res){\n\t\t\t\t\t\tself._continue(res);\n\t\t\t\t\t};\n\t\t\t\t\tthis._pause();\n\t\t\t\t}\n\t\t\t}catch(err){\n\t\t\t\tfired = 1;\n\t\t\t\tres = err;\n\t\t\t}\n\t\t}\n\t\tthis.fired = fired;\n\t\tthis.results[fired] = res;\n\t\tif((cb)&&(this.paused)){\n\t\t\tres.addBoth(cb);\n\t\t}\n\t}\n});\n\n//\n// State Keeping and Reporting\n//\n\ndoh._testCount = 0;\ndoh._groupCount = 0;\ndoh._errorCount = 0;\ndoh._failureCount = 0;\ndoh._currentGroup = null;\ndoh._currentTest = null;\ndoh._paused = true;\n\ndoh._init = function(){\n\tthis._currentGroup = null;\n\tthis._currentTest = null;\n\tthis._errorCount = 0;\n\tthis._failureCount = 0;\n\tthis.debug(this._testCount, \"tests to run in\", this._groupCount, \"groups\");\n}\n\n// doh._urls = [];\ndoh._groups = {};\n\n//\n// Test Registration\n//\n\ndoh.registerTestNs = function(/*String*/ group, /*Object*/ ns){\n\t// summary:\n\t//\t\tadds the passed namespace object to the list of objects to be\n\t//\t\tsearched for test groups. Only \"public\" functions (not prefixed\n\t//\t\twith \"_\") will be added as tests to be run. If you'd like to use\n\t//\t\tfixtures (setUp(), tearDown(), and runTest()), please use\n\t//\t\tregisterTest() or registerTests().\n\tfor(var x in ns){\n\t\tif(\t(x.charAt(0) != \"_\") &&\n\t\t\t(typeof ns[x] == \"function\") ){\n\t\t\tthis.registerTest(group, ns[x]);\n\t\t}\n\t}\n}\n\ndoh._testRegistered = function(group, fixture){\n\t// slot to be filled in\n}\n\ndoh._groupStarted = function(group){\n\t// slot to be filled in\n}\n\ndoh._groupFinished = function(group, success){\n\t// slot to be filled in\n}\n\ndoh._testStarted = function(group, fixture){\n\t// slot to be filled in\n}\n\ndoh._testFinished = function(group, fixture, success){\n\t// slot to be filled in\n}\n\ndoh.registerGroup = function(\t/*String*/ group,\n\t\t\t\t\t\t\t\t/*Array||Function||Object*/ tests,\n\t\t\t\t\t\t\t\t/*Function*/ setUp,\n\t\t\t\t\t\t\t\t/*Function*/ tearDown,\n\t\t\t\t\t\t\t\t/*String*/ type){\n\t// summary:\n\t//\t\tregisters an entire group of tests at once and provides a setUp and\n\t//\t\ttearDown facility for groups. If you call this method with only\n\t//\t\tsetUp and tearDown parameters, they will replace previously\n\t//\t\tinstalled setUp or tearDown functions for the group with the new\n\t//\t\tmethods.\n\t// group:\n\t//\t\tstring name of the group\n\t// tests:\n\t//\t\teither a function or an object or an array of functions/objects. If\n\t//\t\tan object, it must contain at *least* a \"runTest\" method, and may\n\t//\t\talso contain \"setUp\" and \"tearDown\" methods. These will be invoked\n\t//\t\ton either side of the \"runTest\" method (respectively) when the test\n\t//\t\tis run. If an array, it must contain objects matching the above\n\t//\t\tdescription or test functions.\n\t// setUp: a function for initializing the test group\n\t// tearDown: a function for initializing the test group\n\t// type: The type of tests these are, such as a group of performance tests\n\t//\t\tnull/undefied are standard DOH tests, the valye 'perf' enables\n\t//\t\tregistering them as performance tests.\n\tif(tests){\n\t\tthis.register(group, tests, type);\n\t}\n\tif(setUp){\n\t\tthis._groups[group].setUp = setUp;\n\t}\n\tif(tearDown){\n\t\tthis._groups[group].tearDown = tearDown;\n\t}\n}\n\ndoh._getTestObj = function(group, test, type){\n\tvar tObj = test;\n\tif(typeof test == \"string\"){\n\t\tif(test.substr(0, 4)==\"url:\"){\n\t\t\treturn this.registerUrl(group, test);\n\t\t}else{\n\t\t\ttObj = {\n\t\t\t\tname: test.replace(\"/\\s/g\", \"_\") // FIXME: bad escapement\n\t\t\t};\n\t\t\ttObj.runTest = new Function(\"t\", test);\n\t\t}\n\t}else if(typeof test == \"function\"){\n\t\t// if we didn't get a fixture, wrap the function\n\t\ttObj = { \"runTest\": test };\n\t\tif(test[\"name\"]){\n\t\t\ttObj.name = test.name;\n\t\t}else{\n\t\t\ttry{\n\t\t\t\tvar fStr = \"function \";\n\t\t\t\tvar ts = tObj.runTest+\"\";\n\t\t\t\tif(0 <= ts.indexOf(fStr)){\n\t\t\t\t\ttObj.name = ts.split(fStr)[1].split(\"(\", 1)[0];\n\t\t\t\t}\n\t\t\t\t// doh.debug(tObj.runTest.toSource());\n\t\t\t}catch(e){\n\t\t\t}\n\t\t}\n\t\t// FIXME: try harder to get the test name here\n\t}\n\n\t//Augment the test with some specific options to make it identifiable as a\n\t//particular type of test so it can be executed properly.\n\tif(type === \"perf\" || tObj.testType === \"perf\"){\n\t\ttObj.testType = \"perf\";\n\n\t\t//Build an object on the root DOH class to contain all the test results.\n\t\t//Cache it on the test object for quick lookup later for results storage.\n\t\tif(!doh.perfTestResults){\n\t\t\tdoh.perfTestResults = {};\n\t\t\tdoh.perfTestResults[group] = {};\n\t\t}\n\t\tif(!doh.perfTestResults[group]){\n\t\t\tdoh.perfTestResults[group] = {};\n\t\t}\n\t\tif(!doh.perfTestResults[group][tObj.name]){\n\t\t\tdoh.perfTestResults[group][tObj.name] = {};\n\t\t}\n\t\ttObj.results = doh.perfTestResults[group][tObj.name];\n\n\t\t//If it's not set, then set the trial duration\n\t\t//default to 100ms.\n\t\tif(!(\"trialDuration\" in tObj)){\n\t\t\ttObj.trialDuration = 100;\n\t\t}\n\n\t\t//If it's not set, then set the delay between trial runs to 100ms\n\t\t//default to 100ms to allow for GC and to make IE happy.\n\t\tif(!(\"trialDelay\" in tObj)){\n\t\t\ttObj.trialDelay = 100;\n\t\t}\n\n\t\t//If it's not set, then set number of times a trial is run to 10.\n\t\tif(!(\"trialIterations\" in tObj)){\n\t\t\ttObj.trialIterations = 10;\n\t\t}\n\t}\n\treturn tObj;\n}\n\ndoh.registerTest = function(/*String*/ group, /*Function||Object*/ test, /*String*/ type){\n\t// summary:\n\t//\t\tadd the provided test function or fixture object to the specified\n\t//\t\ttest group.\n\t// group:\n\t//\t\tstring name of the group to add the test to\n\t// test:\n\t//\t\teither a function or an object. If an object, it must contain at\n\t//\t\t*least* a \"runTest\" method, and may also contain \"setUp\" and\n\t//\t\t\"tearDown\" methods. These will be invoked on either side of the\n\t//\t\t\"runTest\" method (respectively) when the test is run.\n\t// type:\n\t//\t\tAn identifier denoting the type of testing that the test performs, such\n\t//\t\tas a performance test.  If null, defaults to regular DOH test.\n\tif(!this._groups[group]){\n\t\tthis._groupCount++;\n\t\tthis._groups[group] = [];\n\t\tthis._groups[group].inFlight = 0;\n\t}\n\tvar tObj = this._getTestObj(group, test, type);\n\tif(!tObj){ return null; }\n\tthis._groups[group].push(tObj);\n\tthis._testCount++;\n\tthis._testRegistered(group, tObj);\n\treturn tObj;\n}\n\ndoh.registerTests = function(/*String*/ group, /*Array*/ testArr, /*String*/ type){\n\t// summary:\n\t//\t\tregisters a group of tests, treating each element of testArr as\n\t//\t\tthough it were being (along with group) passed to the registerTest\n\t//\t\tmethod.  It also uses the type to decide how the tests should\n\t//\t\tbehave, by defining the type of tests these are, such as performance tests\n\tfor(var x=0; x<testArr.length; x++){\n\t\tthis.registerTest(group, testArr[x], type);\n\t}\n}\n\n// FIXME: move implementation to _browserRunner?\ndoh.registerUrl = function(\t/*String*/ group,\n\t\t\t\t\t\t\t\t/*String*/ url,\n\t\t\t\t\t\t\t\t/*Integer*/ timeout,\n\t\t\t\t\t\t\t\t/*String*/ type){\n\tthis.debug(\"ERROR:\");\n\tthis.debug(\"\\tNO registerUrl() METHOD AVAILABLE.\");\n\t// this._urls.push(url);\n}\n\ndoh.registerString = function(group, str, type){\n}\n\n// FIXME: remove the doh.add alias SRTL.\ndoh.register = doh.add = function(groupOrNs, testOrNull, type){\n\t// summary:\n\t// \t\t\"magical\" variant of registerTests, registerTest, and\n\t// \t\tregisterTestNs. Will accept the calling arguments of any of these\n\t// \t\tmethods and will correctly guess the right one to register with.\n\tif(\t(arguments.length == 1)&&\n\t\t(typeof groupOrNs == \"string\") ){\n\t\tif(groupOrNs.substr(0, 4)==\"url:\"){\n\t\t\tthis.registerUrl(groupOrNs, null, null, type);\n\t\t}else{\n\t\t\tthis.registerTest(\"ungrouped\", groupOrNs, type);\n\t\t}\n\t}\n\tif(arguments.length == 1){\n\t\tthis.debug(\"invalid args passed to doh.register():\", groupOrNs, \",\", testOrNull);\n\t\treturn;\n\t}\n\tif(typeof testOrNull == \"string\"){\n\t\tif(testOrNull.substr(0, 4)==\"url:\"){\n\t\t\tthis.registerUrl(testOrNull, null, null, type);\n\t\t}else{\n\t\t\tthis.registerTest(groupOrNs, testOrNull, type);\n\t\t}\n\t\t// this.registerTestNs(groupOrNs, testOrNull);\n\t\treturn;\n\t}\n\tif(doh._isArray(testOrNull)){\n\t\tthis.registerTests(groupOrNs, testOrNull, type);\n\t\treturn;\n\t}\n\tthis.registerTest(groupOrNs, testOrNull, type);\n};\n\ndoh.registerDocTests = function(module){\n\t// no-op for when Dojo isn't loaded into the page\n\tthis.debug(\"registerDocTests() requires dojo to be loaded into the environment. Skipping doctest set for module:\", module);\n};\n(function(){\n\tif(typeof dojo != \"undefined\"){\n\t\ttry{\n\t\t\tdojo.require(\"dojox.testing.DocTest\");\n\t\t}catch(e){\n\t\t\t// if the DocTest module isn't available (e.g., the build we're\n\t\t\t// running from doesn't include it), stub it out and log the error\n\t\t\tconsole.debug(e);\n\n\t\t\tdoh.registerDocTests = function(){}\n\t\t\treturn;\n\t\t}\n\t\tdoh.registerDocTests = function(module){\n\t\t\t//\tsummary:\n\t\t\t//\t\tGet all the doctests from the given module and register each of them\n\t\t\t//\t\tas a single test case here.\n\t\t\t//\n\n\t\t\tvar docTest = new dojox.testing.DocTest();\n\t\t\tvar docTests = docTest.getTests(module);\n\t\t\tvar len = docTests.length;\n\t\t\tvar tests = [];\n\t\t\tfor (var i=0; i<len; i++){\n\t\t\t\tvar test = docTests[i];\n\t\t\t\t// Extract comment on first line and add to test name.\n\t\t\t\tvar comment = \"\";\n\t\t\t\tif (test.commands.length && test.commands[0].indexOf(\"//\")!=-1) {\n\t\t\t\t\tvar parts = test.commands[0].split(\"//\");\n\t\t\t\t\tcomment = \", \"+parts[parts.length-1]; // Get all after the last //, so we dont get trapped by http:// or alikes :-).\n\t\t\t\t}\n\t\t\t\ttests.push({\n\t\t\t\t\trunTest: (function(test){\n\t\t\t\t\t\treturn function(t){\n\t\t\t\t\t\t\tvar r = docTest.runTest(test.commands, test.expectedResult);\n\t\t\t\t\t\t\tt.assertTrue(r.success);\n\t\t\t\t\t\t}\n\t\t\t\t\t})(test),\n\t\t\t\t\tname:\"Line \"+test.line+comment\n\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.register(\"DocTests: \"+module, tests);\n\t\t}\n\t}\n})();\n\n//\n// Assertions and In-Test Utilities\n//\n\ndoh.t = doh.assertTrue = function(/*Object*/ condition, /*String?*/ hint){\n\t// summary:\n\t//\t\tis the passed item \"truthy\"?\n\tif(arguments.length < 1){\n\t\tthrow new doh._AssertFailure(\"assertTrue failed because it was not passed at least 1 argument\");\n\t}\n\tif(!eval(condition)){\n\t\tthrow new doh._AssertFailure(\"assertTrue('\" + condition + \"') failed\", hint);\n\t}\n}\n\ndoh.f = doh.assertFalse = function(/*Object*/ condition, /*String?*/ hint){\n\t// summary:\n\t//\t\tis the passed item \"falsey\"?\n\tif(arguments.length < 1){\n\t\tthrow new doh._AssertFailure(\"assertFalse failed because it was not passed at least 1 argument\");\n\t}\n\tif(eval(condition)){\n\t\tthrow new doh._AssertFailure(\"assertFalse('\" + condition + \"') failed\", hint);\n\t}\n}\n\ndoh.e = doh.assertError = function(/*Error object*/expectedError, /*Object*/scope, /*String*/functionName, /*Array*/args, /*String?*/ hint){\n\t//\tsummary:\n\t//\t\tTest for a certain error to be thrown by the given function.\n\t//\texample:\n\t//\t\tt.assertError(dojox.data.QueryReadStore.InvalidAttributeError, store, \"getValue\", [item, \"NOT THERE\"]);\n\t//\t\tt.assertError(dojox.data.QueryReadStore.InvalidItemError, store, \"getValue\", [\"not an item\", \"NOT THERE\"]);\n\ttry{\n\t\tscope[functionName].apply(scope, args);\n\t}catch (e){\n\t\tif(e instanceof expectedError){\n\t\t\treturn true;\n\t\t}else{\n\t\t\tthrow new doh._AssertFailure(\"assertError() failed:\\n\\texpected error\\n\\t\\t\"+expectedError+\"\\n\\tbut got\\n\\t\\t\"+e+\"\\n\\n\", hint);\n\t\t}\n\t}\n\tthrow new doh._AssertFailure(\"assertError() failed:\\n\\texpected error\\n\\t\\t\"+expectedError+\"\\n\\tbut no error caught\\n\\n\", hint);\n}\n\n\ndoh.is = doh.assertEqual = function(/*Object*/ expected, /*Object*/ actual, /*String?*/ hint){\n\t// summary:\n\t//\t\tare the passed expected and actual objects/values deeply\n\t//\t\tequivalent?\n\n\t// Compare undefined always with three equal signs, because undefined==null\n\t// is true, but undefined===null is false.\n\tif((expected === undefined)&&(actual === undefined)){\n\t\treturn true;\n\t}\n\tif(arguments.length < 2){\n\t\tthrow doh._AssertFailure(\"assertEqual failed because it was not passed 2 arguments\");\n\t}\n\tif((expected === actual)||(expected == actual)||\n\t\t\t\t( typeof expected == \"number\" && typeof actual == \"number\" && isNaN(expected) && isNaN(actual) )){\n\t\treturn true;\n\t}\n\tif(\t(this._isArray(expected) && this._isArray(actual))&&\n\t\t(this._arrayEq(expected, actual)) ){\n\t\treturn true;\n\t}\n\tif( ((typeof expected == \"object\")&&((typeof actual == \"object\")))&&\n\t\t(this._objPropEq(expected, actual)) ){\n\t\treturn true;\n\t}\n\tthrow new doh._AssertFailure(\"assertEqual() failed:\\n\\texpected\\n\\t\\t\"+expected+\"\\n\\tbut got\\n\\t\\t\"+actual+\"\\n\\n\", hint);\n}\n\ndoh.isNot = doh.assertNotEqual = function(/*Object*/ notExpected, /*Object*/ actual, /*String?*/ hint){\n\t// summary:\n\t//\t\tare the passed notexpected and actual objects/values deeply\n\t//\t\tnot equivalent?\n\n\t// Compare undefined always with three equal signs, because undefined==null\n\t// is true, but undefined===null is false.\n\tif((notExpected === undefined)&&(actual === undefined)){\n        throw new doh._AssertFailure(\"assertNotEqual() failed: not expected |\"+notExpected+\"| but got |\"+actual+\"|\", hint);\n\t}\n\tif(arguments.length < 2){\n\t\tthrow doh._AssertFailure(\"assertEqual failed because it was not passed 2 arguments\");\n\t}\n\tif((notExpected === actual)||(notExpected == actual)){\n        throw new doh._AssertFailure(\"assertNotEqual() failed: not expected |\"+notExpected+\"| but got |\"+actual+\"|\", hint);\n\t}\n\tif(\t(this._isArray(notExpected) && this._isArray(actual))&&\n\t\t(this._arrayEq(notExpected, actual)) ){\n\t\tthrow new doh._AssertFailure(\"assertNotEqual() failed: not expected |\"+notExpected+\"| but got |\"+actual+\"|\", hint);\n\t}\n\tif( ((typeof notExpected == \"object\")&&((typeof actual == \"object\")))&&\n\t\t(this._objPropEq(notExpected, actual)) ){\n        throw new doh._AssertFailure(\"assertNotEqual() failed: not expected |\"+notExpected+\"| but got |\"+actual+\"|\", hint);\n\t}\n    return true;\n}\n\ndoh._arrayEq = function(expected, actual){\n\tif(expected.length != actual.length){ return false; }\n\t// FIXME: we're not handling circular refs. Do we care?\n\tfor(var x=0; x<expected.length; x++){\n\t\tif(!doh.assertEqual(expected[x], actual[x])){ return false; }\n\t}\n\treturn true;\n}\n\ndoh._objPropEq = function(expected, actual){\n\t// Degenerate case: if they are both null, then their \"properties\" are equal.\n\tif(expected === null && actual === null){\n\t\treturn true;\n\t}\n\t// If only one is null, they aren't equal.\n\tif(expected === null || actual === null){\n\t\treturn false;\n\t}\n\tif(expected instanceof Date){\n\t\treturn actual instanceof Date && expected.getTime()==actual.getTime();\n\t}\n\tvar x;\n\t// Make sure ALL THE SAME properties are in both objects!\n\tfor(x in actual){ // Lets check \"actual\" here, expected is checked below.\n\t\tif(expected[x] === undefined){\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tfor(x in expected){\n\t\tif(!doh.assertEqual(expected[x], actual[x])){\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\ndoh._isArray = function(it){\n\treturn (it && it instanceof Array || typeof it == \"array\" ||\n\t\t(\n\t\t\t!!doh.global[\"dojo\"] &&\n\t\t\tdoh.global[\"dojo\"][\"NodeList\"] !== undefined &&\n\t\t\tit instanceof doh.global[\"dojo\"][\"NodeList\"]\n\t\t)\n\t);\n}\n\n//\n// Runner-Wrapper\n//\n\ndoh._setupGroupForRun = function(/*String*/ groupName, /*Integer*/ idx){\n\tvar tg = this._groups[groupName];\n\tthis.debug(this._line);\n\tthis.debug(\"GROUP\", \"\\\"\"+groupName+\"\\\"\", \"has\", tg.length, \"test\"+((tg.length > 1) ? \"s\" : \"\")+\" to run\");\n}\n\ndoh._handleFailure = function(groupName, fixture, e){\n\t// this.debug(\"FAILED test:\", fixture.name);\n\t// mostly borrowed from JUM\n\tthis._groups[groupName].failures++;\n\tvar out = \"\";\n\tif(e instanceof this._AssertFailure){\n\t\tthis._failureCount++;\n\t\tif(e[\"fileName\"]){ out += e.fileName + ':'; }\n\t\tif(e[\"lineNumber\"]){ out += e.lineNumber + ' '; }\n\t\tout += e+\": \"+e.message;\n\t\tthis.debug(\"\\t_AssertFailure:\", out);\n\t}else{\n\t\tthis._errorCount++;\n\t}\n\tthis.debug(e);\n\tif(fixture.runTest[\"toSource\"]){\n\t\tvar ss = fixture.runTest.toSource();\n\t\tthis.debug(\"\\tERROR IN:\\n\\t\\t\", ss);\n\t}else{\n\t\tthis.debug(\"\\tERROR IN:\\n\\t\\t\", fixture.runTest);\n\t}\n\n\tif(e.rhinoException){\n\t\te.rhinoException.printStackTrace();\n\t}else if(e.javaException){\n\t\te.javaException.printStackTrace();\n\t}\n}\n\n//Assume a setTimeout implementation that is synchronous, so that\n//the Node and Rhino envs work similar to each other. Node defines\n//a setTimeout, so testing for setTimeout is not enough, each environment\n//adapter should set this value accordingly.\ndoh.setTimeout = function(func){\n\treturn func();\n};\n\ndoh._runPerfFixture = function(/*String*/groupName, /*Object*/fixture){\n\t//\tsummary:\n\t//\t\tThis function handles how to execute a 'performance' test\n\t//\t\twhich is different from a straight UT style test.  These\n\t//\t\twill often do numerous iterations of the same operation and\n\t//\t\tgather execution statistics about it, like max, min, average,\n\t//\t\tetc.  It makes use of the already in place DOH deferred test\n\t//\t\thandling since it is a good idea to put a pause inbetween each\n\t//\t\titeration to allow for GC cleanup and the like.\n\t//\n\t//\tgroupName:\n\t//\t\tThe test group that contains this performance test.\n\t//\tfixture:\n\t//\t\tThe performance test fixture.\n\tvar tg = this._groups[groupName];\n\tfixture.startTime = new Date();\n\n\t//Perf tests always need to act in an async manner as there is a\n\t//number of iterations to flow through.\n\tvar def = new doh.Deferred();\n\ttg.inFlight++;\n\tdef.groupName = groupName;\n\tdef.fixture = fixture;\n\n\tdef.addErrback(function(err){\n\t\tdoh._handleFailure(groupName, fixture, err);\n\t});\n\n\t//Set up the finalizer.\n\tvar retEnd = function(){\n\t\tif(fixture[\"tearDown\"]){ fixture.tearDown(doh); }\n\t\ttg.inFlight--;\n\t\tif((!tg.inFlight)&&(tg.iterated)){\n\t\t\tdoh._groupFinished(groupName, !tg.failures);\n\t\t}\n\t\tdoh._testFinished(groupName, fixture, def.results[0]);\n\t\tif(doh._paused){\n\t\t\tdoh.run();\n\t\t}\n\t};\n\n\t//Since these can take who knows how long, we don't want to timeout\n\t//unless explicitly set\n\tvar timer;\n\tvar to = fixture.timeout;\n\tif(to > 0) {\n\t\ttimer = doh.setTimeout(function(){\n\t\t\t// ret.cancel();\n\t\t\t// retEnd();\n\t\t\tdef.errback(new Error(\"test timeout in \"+fixture.name.toString()));\n\t\t}, to);\n\t}\n\n\t//Set up the end calls to the test into the deferred we'll return.\n\tdef.addBoth(function(arg){\n\t\tif(timer){\n\t\t\tclearTimeout(timer);\n\t\t}\n\t\tretEnd();\n\t});\n\n\t//Okay, now set up the timing loop for the actual test.\n\t//This is down as an async type test where there is a delay\n\t//between each execution to allow for GC time, etc, so the GC\n\t//has less impact on the tests.\n\tvar res = fixture.results;\n\tres.trials = [];\n\n\t//Try to figure out how many calls are needed to hit a particular threshold.\n\tvar itrDef = doh._calcTrialIterations(groupName, fixture);\n\titrDef.addErrback(function(err){\n\t\tfixture.endTime = new Date();\n\t\tdef.errback(err);\n\t});\n\n\t//Blah, since tests can be deferred, the actual run has to be deferred until after\n\t//we know how many iterations to run.  This is just plain ugly.\n\titrDef.addCallback(function(iterations){\n\t\tif(iterations){\n\t\t\tvar countdown = fixture.trialIterations;\n\t\t\tdoh.debug(\"TIMING TEST: [\" + fixture.name +\n\t\t\t\t\t  \"]\\n\\t\\tITERATIONS PER TRIAL: \" +\n\t\t\t\t\t  iterations + \"\\n\\tTRIALS: \" +\n\t\t\t\t\t  countdown);\n\n\t\t\t//Figure out how many times we want to run our 'trial'.\n\t\t\t//Where each trial consists of 'iterations' of the test.\n\n\t\t\tvar trialRunner = function() {\n\t\t\t\t//Set up our function to execute a block of tests\n\t\t\t\tvar start = new Date();\n\t\t\t\tvar tTimer = new doh.Deferred();\n\t\t\t\tvar tCountdown = iterations;\n\n\t\t\t\tvar tState = {\n\t\t\t\t\tcountdown: iterations\n\t\t\t\t};\n\t\t\t\tvar testRunner = function(state){\n\t\t\t\t\twhile(state){\n\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\tstate.countdown--;\n\t\t\t\t\t\t\tif(state.countdown){\n\t\t\t\t\t\t\t\tvar ret = fixture.runTest(doh);\n\t\t\t\t\t\t\t\tif(ret instanceof doh.Deferred){\n\t\t\t\t\t\t\t\t\t//Deferreds have to be handled async,\n\t\t\t\t\t\t\t\t\t//otherwise we just keep looping.\n\t\t\t\t\t\t\t\t\tvar atState = {\n\t\t\t\t\t\t\t\t\t\tcountdown: state.countdown\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tret.addCallback(function(){\n\t\t\t\t\t\t\t\t\t\ttestRunner(atState);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tret.addErrback(function(err) {\n\t\t\t\t\t\t\t\t\t\tdoh._handleFailure(groupName, fixture, err);\n\t\t\t\t\t\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\t\t\t\t\t\tdef.errback(err);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tstate = null;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\ttTimer.callback(new Date());\n\t\t\t\t\t\t\t\tstate = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}catch(err){\n\t\t\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\t\t\ttTimer.errback(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\ttTimer.addCallback(function(end){\n\t\t\t\t\t//Figure out the results and try to factor out function call costs.\n\t\t\t\t\tvar tResults = {\n\t\t\t\t\t\ttrial: (fixture.trialIterations - countdown),\n\t\t\t\t\t\ttestIterations: iterations,\n\t\t\t\t\t\texecutionTime: (end.getTime() - start.getTime()),\n\t\t\t\t\t\taverage: (end.getTime() - start.getTime())/iterations\n\t\t\t\t\t};\n\t\t\t\t\tres.trials.push(tResults);\n\t\t\t\t\tdoh.debug(\"\\n\\t\\tTRIAL #: \" +\n\t\t\t\t\t\t\t  tResults.trial + \"\\n\\tTIME: \" +\n\t\t\t\t\t\t\t  tResults.executionTime + \"ms.\\n\\tAVG TEST TIME: \" +\n\t\t\t\t\t\t\t  (tResults.executionTime/tResults.testIterations) + \"ms.\");\n\n\t\t\t\t\t//Okay, have we run all the trials yet?\n\t\t\t\t\tcountdown--;\n\t\t\t\t\tif(countdown){\n\t\t\t\t\t\tdoh.setTimeout(trialRunner, fixture.trialDelay);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//Okay, we're done, lets compute some final performance results.\n\t\t\t\t\t\tvar t = res.trials;\n\n\n\n\t\t\t\t\t\t//We're done.\n\t\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\t\tdef.callback(true);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttTimer.addErrback(function(err){\n\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\tdef.errback(err);\n\t\t\t\t});\n\t\t\t\ttestRunner(tState);\n\t\t\t};\n\t\t\ttrialRunner();\n\t\t}\n\t});\n\n\t//Set for a pause, returned the deferred.\n\tif(def.fired < 0){\n\t\tdoh.pause();\n\t}\n\treturn def;\n};\n\ndoh._calcTrialIterations =  function(/*String*/ groupName, /*Object*/ fixture){\n\t//\tsummary:\n\t//\t\tThis function determines the rough number of iterations to\n\t//\t\tuse to reach a particular MS threshold.  This returns a deferred\n\t//\t\tsince tests can theoretically by async.  Async tests aren't going to\n\t//\t\tgive great perf #s, though.\n\t//\t\tThe callback is passed the # of iterations to hit the requested\n\t//\t\tthreshold.\n\t//\n\t//\tfixture:\n\t//\t\tThe test fixture we want to calculate iterations for.\n\tvar def = new doh.Deferred();\n\tvar calibrate = function () {\n\t\tvar testFunc = fixture.runTest;\n\n\t\t//Set the initial state.  We have to do this as a loop instead\n\t\t//of a recursive function.  Otherwise, it blows the call stack\n\t\t//on some browsers.\n\t\tvar iState = {\n\t\t\tstart: new Date(),\n\t\t\tcurIter: 0,\n\t\t\titerations: 5\n\t\t};\n\t\tvar handleIteration = function(state){\n\t\t\twhile(state){\n\t\t\t\tif(state.curIter < state.iterations){\n\t\t\t\t\ttry{\n\t\t\t\t\t\tvar ret = testFunc(doh);\n\t\t\t\t\t\tif(ret instanceof doh.Deferred){\n\t\t\t\t\t\t\tvar aState = {\n\t\t\t\t\t\t\t\tstart: state.start,\n\t\t\t\t\t\t\t\tcurIter: state.curIter + 1,\n\t\t\t\t\t\t\t\titerations: state.iterations\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tret.addCallback(function(){\n\t\t\t\t\t\t\t\thandleIteration(aState);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tret.addErrback(function(err) {\n\t\t\t\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\t\t\t\tdef.errback(err);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tstate = null;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tstate.curIter++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}catch(err){\n\t\t\t\t\t\tfixture.endTime = new Date();\n\t\t\t\t\t\tdef.errback(err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tvar end = new Date();\n\t\t\t\t\tvar totalTime = (end.getTime() - state.start.getTime());\n\t\t\t\t\tif(totalTime < fixture.trialDuration){\n\t\t\t\t\t\tvar nState = {\n\t\t\t\t\t\t\titerations: state.iterations * 2,\n\t\t\t\t\t\t\tcurIter: 0\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate = null;\n\t\t\t\t\t\tdoh.setTimeout(function(){\n\t\t\t\t\t\t\tnState.start = new Date();\n\t\t\t\t\t\t\thandleIteration(nState);\n\t\t\t\t\t\t}, 50);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar itrs = state.iterations;\n\t\t\t\t\t\tdoh.setTimeout(function(){def.callback(itrs)}, 50);\n\t\t\t\t\t\tstate = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\thandleIteration(iState);\n\t};\n\tdoh.setTimeout(calibrate, 10);\n\treturn def;\n};\n\ndoh._runRegFixture = function(/*String*/groupName, /*Object*/fixture){\n\t//\tsummary:\n\t//\t\tFunction to run a generic doh test.  These are not\n\t//\t\tspecialized tests, like performance groups and such.\n\t//\n\t//\tgroupName:\n\t//\t\tThe groupName of the test.\n\t//\tfixture:\n\t//\t\tThe test fixture to execute.\n\tvar tg = this._groups[groupName];\n\tfixture.startTime = new Date();\n\tvar ret = fixture.runTest(this);\n\tfixture.endTime = new Date();\n\t// if we get a deferred back from the test runner, we know we're\n\t// gonna wait for an async result. It's up to the test code to trap\n\t// errors and give us an errback or callback.\n\tif(ret instanceof doh.Deferred){\n\t\ttg.inFlight++;\n\t\tret.groupName = groupName;\n\t\tret.fixture = fixture;\n\n\t\tret.addErrback(function(err){\n\t\t\tdoh._handleFailure(groupName, fixture, err);\n\t\t});\n\n\t\tvar retEnd = function(){\n\t\t\tif(fixture[\"tearDown\"]){ fixture.tearDown(doh); }\n\t\t\ttg.inFlight--;\n\t\t\tif((!tg.inFlight)&&(tg.iterated)){\n\t\t\t\tdoh._groupFinished(groupName, !tg.failures);\n\t\t\t}\n\t\t\tdoh._testFinished(groupName, fixture, ret.results[0]);\n\t\t\tif(doh._paused){\n\t\t\t\tdoh.run();\n\t\t\t}\n\t\t}\n\n\t\tvar timer = doh.setTimeout(function(){\n\t\t\t// ret.cancel();\n\t\t\t// retEnd();\n\t\t\tret.errback(new Error(\"test timeout in \"+fixture.name.toString()));\n\t\t}, fixture[\"timeout\"]||1000);\n\n\t\tret.addBoth(function(arg){\n\t\t\tclearTimeout(timer);\n\t\t\tretEnd();\n\t\t});\n\t\tif(ret.fired < 0){\n\t\t\tdoh.pause();\n\t\t}\n\t\treturn ret;\n\t}\n};\n\ndoh._runFixture = function(groupName, fixture){\n\tvar tg = this._groups[groupName];\n\tthis._testStarted(groupName, fixture);\n\tvar threw = false;\n\tvar err = null;\n\t// run it, catching exceptions and reporting them\n\ttry{\n\t\t// let doh reference \"this.group.thinger...\" which can be set by\n\t\t// another test or group-level setUp function\n\t\tfixture.group = tg;\n\t\t// only execute the parts of the fixture we've got\n\n\t\tif(fixture[\"setUp\"]){ fixture.setUp(this); }\n\t\tif(fixture[\"runTest\"]){  // should we error out of a fixture doesn't have a runTest?\n\t\t\tif(fixture.testType === \"perf\"){\n\t\t\t\t//Always async deferred, so return it.\n\t\t\t\treturn doh._runPerfFixture(groupName, fixture);\n\t\t\t}else{\n\t\t\t\t//May or may not by async.\n\t\t\t\tvar ret = doh._runRegFixture(groupName, fixture);\n\t\t\t\tif(ret){\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(fixture[\"tearDown\"]){ fixture.tearDown(this); }\n\t}catch(e){\n\t\tthrew = true;\n\t\terr = e;\n\t\tif(!fixture.endTime){\n\t\t\tfixture.endTime = new Date();\n\t\t}\n\t}\n\tvar d = new doh.Deferred();\n\tdoh.setTimeout(this.hitch(this, function(){\n\t\tif(threw){\n\t\t\tthis._handleFailure(groupName, fixture, err);\n\t\t}\n\t\tthis._testFinished(groupName, fixture, !threw);\n\n\t\tif((!tg.inFlight)&&(tg.iterated)){\n\t\t\tdoh._groupFinished(groupName, !tg.failures);\n\t\t}else if(tg.inFlight > 0){\n\t\t\tdoh.setTimeout(this.hitch(this, function(){\n\t\t\t\tdoh.runGroup(groupName); // , idx);\n\t\t\t}), 100);\n\t\t\tthis._paused = true;\n\t\t}\n\t\tif(doh._paused){\n\t\t\tdoh.run();\n\t\t}\n\t}), 30);\n\tdoh.pause();\n\treturn d;\n}\n\ndoh._testId = 0;\ndoh.runGroup = function(/*String*/ groupName, /*Integer*/ idx){\n\t// summary:\n\t//\t\truns the specified test group\n\n\t// the general structure of the algorithm is to run through the group's\n\t// list of doh, checking before and after each of them to see if we're in\n\t// a paused state. This can be caused by the test returning a deferred or\n\t// the user hitting the pause button. In either case, we want to halt\n\t// execution of the test until something external to us restarts it. This\n\t// means we need to pickle off enough state to pick up where we left off.\n\n\t// FIXME: need to make fixture execution async!!\n\n\tvar tg = this._groups[groupName];\n\tif(tg.skip === true){ return; }\n\tif(this._isArray(tg)){\n\t\tif(idx<=tg.length){\n\t\t\tif((!tg.inFlight)&&(tg.iterated == true)){\n\t\t\t\tif(tg[\"tearDown\"]){ tg.tearDown(this); }\n\t\t\t\tdoh._groupFinished(groupName, !tg.failures);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif(!idx){\n\t\t\ttg.inFlight = 0;\n\t\t\ttg.iterated = false;\n\t\t\ttg.failures = 0;\n\t\t}\n\t\tdoh._groupStarted(groupName);\n\t\tif(!idx){\n\t\t\tthis._setupGroupForRun(groupName, idx);\n\t\t\tif(tg[\"setUp\"]){ tg.setUp(this); }\n\t\t}\n\t\tfor(var y=(idx||0); y<tg.length; y++){\n\t\t\tif(this._paused){\n\t\t\t\tthis._currentTest = y;\n\t\t\t\t// this.debug(\"PAUSED at:\", tg[y].name, this._currentGroup, this._currentTest);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdoh._runFixture(groupName, tg[y]);\n\t\t\tif(this._paused){\n\t\t\t\tthis._currentTest = y+1;\n\t\t\t\tif(this._currentTest == tg.length){\n\t\t\t\t\ttg.iterated = true;\n\t\t\t\t}\n\t\t\t\t// this.debug(\"PAUSED at:\", tg[y].name, this._currentGroup, this._currentTest);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\ttg.iterated = true;\n\t\tif(!tg.inFlight){\n\t\t\tif(tg[\"tearDown\"]){ tg.tearDown(this); }\n\t\t\tdoh._groupFinished(groupName, !tg.failures);\n\t\t}\n\t}\n}\n\ndoh._onEnd = function(){}\n\ndoh._report = function(){\n\t// summary:\n\t//\t\ta private method to be implemented/replaced by the \"locally\n\t//\t\tappropriate\" test runner\n\n\t// this.debug(\"ERROR:\");\n\t// this.debug(\"\\tNO REPORTING OUTPUT AVAILABLE.\");\n\t// this.debug(\"\\tIMPLEMENT doh._report() IN YOUR TEST RUNNER\");\n\n\tthis.debug(this._line);\n\tthis.debug(\"| TEST SUMMARY:\");\n\tthis.debug(this._line);\n\tthis.debug(\"\\t\", this._testCount, \"tests in\", this._groupCount, \"groups\");\n\tthis.debug(\"\\t\", this._errorCount, \"errors\");\n\tthis.debug(\"\\t\", this._failureCount, \"failures\");\n}\n\ndoh.togglePaused = function(){\n\tthis[(this._paused) ? \"run\" : \"pause\"]();\n}\n\ndoh.pause = function(){\n\t// summary:\n\t//\t\thalt test run. Can be resumed.\n\tthis._paused = true;\n}\n\ndoh.run = function(){\n\t// summary:\n\t//\t\tbegins or resumes the test process.\n\t// this.debug(\"STARTING\");\n\tthis._paused = false;\n\tvar cg = this._currentGroup;\n\tvar ct = this._currentTest;\n\tvar found = false;\n\tif(!cg){\n\t\tthis._init(); // we weren't paused\n\t\tfound = true;\n\t}\n\tthis._currentGroup = null;\n\tthis._currentTest = null;\n\n\tfor(var x in this._groups){\n\t\tif(\n\t\t\t( (!found)&&(x == cg) )||( found )\n\t\t){\n\t\t\tif(this._paused){ return; }\n\t\t\tthis._currentGroup = x;\n\t\t\tif(!found){\n\t\t\t\tfound = true;\n\t\t\t\tthis.runGroup(x, ct);\n\t\t\t}else{\n\t\t\t\tthis.runGroup(x);\n\t\t\t}\n\t\t\tif(this._paused){ return; }\n\t\t}\n\t}\n\tthis._currentGroup = null;\n\tthis._currentTest = null;\n\tthis._paused = false;\n\tthis._onEnd();\n\tthis._report();\n}\n\n//Statistics functions to handle computing performance metrics.\n//Taken from dojox.math\n//\tbasic statistics\ndoh.standardDeviation = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the standard deviation of the passed arguments.\n\treturn Math.sqrt(this.variance(a));\t//\tNumber\n};\n\ndoh.variance = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tFind the variance in the passed array of numbers.\n\tvar mean=0, squares=0;\n\tdojo.forEach(a, function(item){\n\t\tmean+=item;\n\t\tsquares+=Math.pow(item,2);\n\t});\n\treturn (squares/a.length)-Math.pow(mean/a.length, 2);\t//\tNumber\n};\n\ndoh.mean = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the mean value in the passed array.\n\tvar t=0;\n\tdojo.forEach(a, function(v){\n\t\tt += v;\n\t});\n\treturn t / Math.max(a.length, 1);\t//\tNumber\n};\n\ndoh.min = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the min value in the passed array.\n\treturn Math.min.apply(null, a);\t\t//\tNumber\n};\n\ndoh.max = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the max value in the passed array.\n\treturn Math.max.apply(null, a);\t\t//\tNumber\n},\n\ndoh.median= function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the value closest to the middle from a sorted version of the passed array.\n\treturn a.slice(0).sort()[Math.ceil(a.length/2)-1];\t//\tNumber\n},\n\ndoh.mode = function(/* Number[] */a){\n\t//\tsummary:\n\t//\t\tReturns the mode from the passed array (number that appears the most often).\n\t//\t\tThis is not the most efficient method, since it requires a double scan, but\n\t//\t\tis ensures accuracy.\n\tvar o = {}, r = 0, m = Number.MIN_VALUE;\n\tdojo.forEach(a, function(v){\n\t\t(o[v]!==undefined)?o[v]++:o[v]=1;\n\t});\n\n\t//\twe did the lookup map because we need the number that appears the most.\n\tfor(var p in o){\n\t\tif(m < o[p]){\n\t\t\tm = o[p], r = p;\n\t\t}\n\t}\n\treturn r;\t//\tNumber\n};\n\ndoh.average = function(/* Number [] */ a){\n\tvar i;\n\tvar s = 0;\n\tfor(i = 0; i < a.length; i++){\n\t\ts += a[i];\n\t}\n\treturn s/a.length;\n}\n\ntests = doh;\n\nif (typeof skipDohSetup === \"undefined\") {\n\n    (function(){\n            // scope protection\n            var x;\n            try{\n                    if(typeof dojo != \"undefined\"){\n                            dojo.platformRequire({\n                                    browser: [\"doh._browserRunner\"],\n                                    rhino: [\"doh._rhinoRunner\"],\n                                    spidermonkey: [\"doh._rhinoRunner\"]\n                            });\n                            try{\n                                    var _shouldRequire = dojo.isBrowser ? (dojo.global == dojo.global[\"parent\"] || !Boolean(dojo.global.parent.doh) ) : true;\n                            }catch(e){\n                                    //can't access dojo.global.parent.doh, then we need to do require\n                                    _shouldRequire = true;\n                            }\n                            if(_shouldRequire){\n                                    if(dojo.isBrowser){\n                                            dojo.addOnLoad(function(){\n                                                    if (dojo.global.registerModulePath){\n                                                            dojo.forEach(dojo.global.registerModulePath, function(m){\n                                                                    dojo.registerModulePath(m[0], m[1]);\n                                                            });\n                                                    }\n                                                    if(dojo.byId(\"testList\")){\n                                                            var _tm = ( (dojo.global.testModule && dojo.global.testModule.length) ? dojo.global.testModule : \"dojo.tests.module\");\n                                                            dojo.forEach(_tm.split(\",\"), dojo.require, dojo);\n                                                            doh.setTimeout(function(){\n                                                                    doh.run();\n                                                            }, 500);\n                                                    }\n                                            });\n                                    }else{\n                                            // dojo.require(\"doh._base\");\n                                    }\n                            }\n                    }else{\n                            if(typeof load == \"function\" &&\n                                    (typeof Packages == \"function\" || typeof Packages == \"object\")){\n                                    throw new Error();\n                            }else if(typeof load == \"function\"){\n                                    throw new Error();\n                            }\n\n                            if(this[\"document\"]){\n                                    /*\n                                    // if we survived all of that, we're probably in a browser but\n                                    // don't have Dojo handy. Load _browserRunner.js using a\n                                    // document.write() call.\n\n                                    // find runner.js, load _browserRunner relative to it\n                                    var scripts = document.getElementsByTagName(\"script\"), runnerFile;\n                                    for(x=0; x<scripts.length; x++){\n                                            var s = scripts[x].src;\n                                            if(s){\n                                                    if(!runnerFile && s.substr(s.length - 9) == \"runner.js\"){\n                                                            runnerFile = s;\n                                                    }else if(s.substr(s.length - 17) == \"_browserRunner.js\"){\n                                                            runnerFile = null;\n                                                            break;\n                                                    }\n                                            }\n                                    }\n                                    if(runnerFile){\n                                            document.write(\"<scri\"+\"pt src='\" + runnerFile.substr(0, runnerFile.length - 9)\n                                                    + \"_browserRunner.js' type='text/javascript'></scr\"+\"ipt>\");\n                                    }\n                                    */\n                            }\n                    }\n            }catch(e){\n                    print(\"\\n\"+doh._line);\n                    print(\"The Dojo Unit Test Harness, $Rev: 20389 $\");\n                    print(\"Copyright (c) 2009, The Dojo Foundation, All Rights Reserved\");\n                    print(doh._line, \"\\n\");\n\n                    try{\n                            var dojoUrl = \"../../dojo/dojo.js\";\n                            var testUrl = \"\";\n                            var testModule = \"dojo.tests.module\";\n                            var dohBase = \"\";\n                            for(x=0; x<arguments.length; x++){\n                                    if(arguments[x].indexOf(\"=\") > 0){\n                                            var tp = arguments[x].split(\"=\");\n                                            if(tp[0] == \"dohBase\"){\n                                                    dohBase = tp[1];\n                                                    //Convert slashes to unix style and make sure properly\n                                                    //ended.\n                                                    dohBase = dohBase.replace(/\\\\/g, \"/\");\n                                                    if(dohBase.charAt(dohBase.length - 1) != \"/\"){\n                                                            dohBase += \"/\";\n                                                    }\n                                            }\n                                            if(tp[0] == \"dojoUrl\"){\n                                                    dojoUrl = tp[1];\n                                            }\n                                            if(tp[0] == \"testUrl\"){\n                                                    testUrl = tp[1];\n                                            }\n                                            if(tp[0] == \"testModule\"){\n                                                    testModule = tp[1];\n                                            }\n                                    }\n                            }\n\n                            load(dohBase + \"_rhinoRunner.js\");\n\n                            if(dojoUrl.length){\n                                    if(!this[\"djConfig\"]){\n                                            djConfig = {};\n                                    }\n                                    djConfig.baseUrl = dojoUrl.split(\"dojo.js\")[0];\n                                    load(dojoUrl);\n                            }\n                            if(testUrl.length){\n                                    load(testUrl);\n                            }\n                            if(testModule.length){\n                                    dojo.forEach(testModule.split(\",\"), dojo.require, dojo);\n                            }\n                    }catch(e){\n                            print(\"An exception occurred: \" + e);\n                    }\n\n                    doh.run();\n            }\n    }).apply(this, typeof arguments != \"undefined\" ? arguments : [null]);\n}\n"
  },
  {
    "path": "tests/doh/runner.sh",
    "content": "#!/bin/sh\n\njava -jar ../../build/lib/rhino/js.jar runner.js \"$@\"\n"
  },
  {
    "path": "tests/emptyRequire/emptyRequire.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Empty Require Test</title>\n    <script src=\"../doh/runner.js\"></script>\n    <script src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script>\n        require([], function () {\n            doh.register(\n                'emptyRequire',\n                [\n                    function emptyRequire(t){\n                        t.is(true, true);\n                    }\n                ]\n            );\n            doh.run();\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: Empty Require Test</h1>\n    <p>Empty require array should still call callback.\n        <a href=\"https://github.com/requirejs/alameda/issues/5\">More info</a></p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/errback/errback.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: errback Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n        var master = new doh.Deferred();\n            count = 0;\n\n        function done() {\n            count += 1;\n            if (count === 2) {\n                master.callback(true);\n            }\n        }\n\n        //Register the test\n        doh.register(\n            \"errback\",\n            [\n                {\n                    name: \"errback\",\n                    timeout: 2000,\n                    runTest: function () {\n                        return master;\n                    }\n                }\n            ]\n        );\n        doh.run();\n\n\n        define('plug', function () {\n            return {\n                load: function (id, require, load, config) {\n                    require([id], load, function (err) {\n                        throw err;\n                    });\n                }\n            }\n        })\n\n        define('c', ['plug!foo'], function (foo) {\n            return {\n                name: 'c',\n                foo: foo\n            };\n        });\n\n        define('fu/a', ['require'], function(require){\n            var myC = null;\n\n            require(['c'], function (c) {\n                myC = c;\n                doh.is('c', myC.name);\n                doh.is('foo', myC.foo.name);\n                done();\n            }, function (err) {\n                //This should not be triggered\n                throw err;\n            });\n\n            //Make sure require is async\n            doh.is(null, myC);\n\n            return {\n                name: 'fu/a'\n            };\n        });\n\n        define('foo', {\n            name: 'foo'\n        });\n\n        define('foo/bar/c',['../../fu/a'], function(v){\n            return {\n                name: 'foo/bar/c',\n                fuA: v\n            };\n        });\n\n        define('foo/b',['require', './bar/c'], function(require){\n            return {\n                name: 'foo/b',\n                barC: require('./bar/c')\n            };\n        });\n\n        define('main', ['./foo/b'], function(v){\n            return {\n                name: 'main',\n                fooB: v\n            };\n        });\n\n        var myMain = null;\n\n        require(['main'], function(main){\n            myMain = main;\n            doh.is('main', myMain.name);\n            doh.is('foo/b', myMain.fooB.name);\n            doh.is('foo/bar/c', myMain.fooB.barC.name);\n            doh.is('fu/a', myMain.fooB.barC.fuA.name);\n            done();\n        }, function (err) {\n            //This should never be reached, but it should not cause\n            //a problem either.\n            throw err;\n        });\n\n        //Make sure require is async\n        doh.is(null, myMain);\n\n    </script>\n</head>\n<body>\n    <h1>alameda: errback Test</h1>\n\n    <p>Test the use of errbacks in a require call. While alameda does not\n        support calling an errback (all modules should be built in and usable),\n        alameda should not throw any errors if they are used.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/hasOwnProperty/hasOwnProperty.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: hasOwnProperty Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script>\n\n        define('prototype', {\n            name: 'prototype'\n        });\n        define('toString', {\n            name: 'toString'\n        });\n        define('hasOwnProperty', {\n            name: 'hasOwnProperty'\n        });\n\n        require([\"toString\", \"hasOwnProperty\", \"prototype\"], function(toString, hop, p) {\n                doh.register(\n                    \"hasOwnPropertyTests\",\n                    [\n                        function hasOwnPropertyTests(t){\n                            t.is(\"toString\", toString.name);\n                            t.is(\"hasOwnProperty\", hop.name);\n                            t.is(\"prototype\", p.name);\n                        }\n                    ]\n                );\n                doh.run();\n            }\n        );\n    </script>\n</head>\n<body>\n    <h1>alameda: hasOwnProperty Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda tests</title>\n</head>\n<body>\n    <h1>alameda tests</h1>\n    <ol>\n        <li><a href=\"doh/runner.html?testUrl=../all\">All Automated Tests</a>\n    </ol>\n</body>\n</html>\n"
  },
  {
    "path": "tests/insertRequire/insertRequire.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: insertRequire Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n        define('a', ['b'], function (b) {\n            doh.register(\n                'insertRequire',\n                [\n                    function insertRequire(t){\n                        t.is('b', b.name);\n                    }\n                ]\n            );\n            doh.run();\n        });\n\n        define('b', {\n            name: 'b'\n        });\n\n        require(['a']);\n    </script>\n</head>\n<body>\n    <h1>alameda: insertRequire Test</h1>\n\n    <p>Make sure alameda can handle juse a plain require(['a']) used by\n    r.js's insertRequire build option. More info:\n    <a href=\"https://github.com/requirejs/almond/issues/27\">27</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfig.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Map Config Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"mapConfig.js\"></script>\n</head>\n<body>\n    <h1>alameda: Map Config Test</h1>\n    <p>Test using the map config.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfig.js",
    "content": "\ndefine('c1',{\n    name: 'c1'\n});\n\ndefine('c1/sub',{\n    name: 'c1/sub'\n});\n\ndefine('a',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('c',{\n    name: 'c'\n});\n\ndefine('c/sub',{\n    name: 'c/sub'\n});\n\ndefine('b',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('c2',{\n    name: 'c2'\n});\n\ndefine('c2/sub',{\n    name: 'c2/sub'\n});\n\ndefine('a/sub/one',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\nrequire({\n        baseUrl: './',\n        paths: {\n            a: 'a1'\n        },\n\n        map: {\n            'a': {\n                c: 'c1'\n            },\n            'a/sub/one': {\n                'c': 'c2'\n            }\n        }\n    },\n    ['a', 'b', 'c', 'a/sub/one'],\n    function(a, b, c, one) {\n        doh.register(\n            'mapConfig',\n            [\n                function mapConfig(t){\n                    t.is('c1', a.c.name);\n                    t.is('c1/sub', a.csub.name);\n                    t.is('c2', one.c.name);\n                    t.is('c2/sub', one.csub.name);\n                    t.is('c', b.c.name);\n                    t.is('c/sub', b.csub.name);\n                    t.is('c', c.name);\n                }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"mapConfig-tests\", function(){});\n"
  },
  {
    "path": "tests/mapConfig/mapConfigPlugin.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Map Config Plugin Built Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"mapConfigPlugin.js\"></script>\n</head>\n<body>\n    <h1>alameda: Map Config Plugin Built Test</h1>\n    <p>Test using the map config with plugin value after a build.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfigPlugin.js",
    "content": "\ndefine('plug',{\n    load: function (name, require, load, config) {\n        if (!name) {\n            name = 'main';\n        } else if (name.charAt(0) === '/') {\n            name = 'main' + name;\n        }\n\n        //Only grab the first segment of the name.\n        //This is just to be different, nothing\n        //that is required behavior.\n        name = name.split('/').shift();\n\n        name = 'plug/' + name;\n\n        require([name], load);\n    }\n});\ndefine('plug/c1',{\n    name: 'plug!c1'\n});\n\ndefine('a',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('plug/main',{\n    name: 'plug!main'\n});\n\ndefine('b',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('plug/c2',{\n    name: 'plug!c2'\n});\n\ndefine('a/sub/one',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\nrequire({\n        baseUrl: './',\n        paths: {\n            a: 'a1'\n        },\n\n        map: {\n            '*': {\n                c: 'plug!'\n            },\n            'a': {\n                c: 'plug!c1'\n            },\n            'a/sub/one': {\n                'c': 'plug!c2'\n            }\n        }\n    },\n    ['a', 'b', 'c', 'a/sub/one'],\n    function(a, b, c, one) {\n        doh.register(\n            'mapConfigPlugin',\n            [\n                function mapConfigPlugin(t){\n                    t.is('plug!c1', a.c.name);\n                    t.is('plug!c1', a.csub.name);\n                    t.is('plug!c2', one.c.name);\n                    t.is('plug!c2', one.csub.name);\n                    t.is('plug!main', b.c.name);\n                    t.is('plug!main', b.csub.name);\n                    t.is('plug!main', c.name);\n                }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"mapConfigPlugin-tests\", function(){});\n"
  },
  {
    "path": "tests/mapConfig/mapConfigSpecificity.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Map Config Specificity Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"mapConfigSpecificity.js\"></script>\n</head>\n<body>\n    <h1>alameda: Map Config Specificity Test</h1>\n    <p>Test map config specificity.\n        <a href=\"https://github.com/requirejs/almond/issues/35\">More info</a>.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfigSpecificity.js",
    "content": "/*jslint sloppy: true */\n/*global define, require, doh */\ndefine('foo-1.0/bar/baz', [], function () { return '1.0'; });\ndefine('foo-1.2/bar/baz', [], function () { return '1.2'; });\n\ndefine('oldmodule', ['foo/bar/baz'], function (baz) {\n    return {\n        name: 'oldmodule',\n        baz: baz\n    };\n});\n\n\nrequire({\n    baseUrl: './',\n\n    map: {\n        'oldmodule': {\n            //This one should be favored over the * value.\n            'foo' : 'foo-1.0'\n        },\n\n        '*': {\n            'foo/bar' : 'foo-1.2/bar'\n        }\n    }\n},\n    ['oldmodule'],\n    function (oldmodule) {\n        doh.register(\n            'mapConfigSpecificity',\n            [\n                function mapConfigSpecificity(t) {\n                    t.is('oldmodule', oldmodule.name);\n                    t.is('1.0', oldmodule.baz);\n                }\n            ]\n        );\n        doh.run();\n    });\n\n"
  },
  {
    "path": "tests/mapConfig/mapConfigStar.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Map Config Star Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"mapConfigStar.js\"></script>\n</head>\n<body>\n    <h1>alameda: Map Config Star Test</h1>\n    <p>Test using '*' in the map config.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfigStar.js",
    "content": "\ndefine('c1',{\n    name: 'c1'\n});\n\ndefine('c1/sub',{\n    name: 'c1/sub'\n});\n\ndefine('a',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('another/minor',{\n    name: 'another/minor'\n});\n\n\ndefine('another/c',['./minor'], function (minor) {\n    return {\n        name: 'another/c',\n        minorName: minor.name\n    };\n});\n\ndefine('another/c/dim',{\n    name: 'another/c/dim'\n});\n\ndefine('another/c/sub',['./dim'], function (dim) {\n    return {\n        name: 'another/c/sub',\n        dimName: dim.name\n    };\n});\n\ndefine('b',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\ndefine('c2',{\n    name: 'c2'\n});\n\ndefine('a/sub/one',['c', 'c/sub'], function (c, csub) {\n    return {\n        c: c,\n        csub: csub\n    };\n});\n\nrequire({\n        baseUrl: './',\n        paths: {\n            a: 'a1'\n        },\n\n        map: {\n            '*': {\n                'c': 'another/c'\n            },\n            'a': {\n                c: 'c1'\n            },\n            'a/sub/one': {\n                'c': 'c2',\n                'c/sub': 'another/c/sub'\n            }\n        }\n    },\n    ['a', 'b', 'c', 'a/sub/one'],\n    function(a, b, c, one) {\n        doh.register(\n            'mapConfigStar',\n            [\n                function mapConfigStar(t){\n                    t.is('c1', a.c.name);\n                    t.is('c1/sub', a.csub.name);\n                    t.is('c2', one.c.name);\n                    t.is('another/c/sub', one.csub.name);\n                    t.is('another/c/dim', one.csub.dimName);\n                    t.is('another/c', b.c.name);\n                    t.is('another/minor', b.c.minorName);\n                    t.is('another/c/sub', b.csub.name);\n                    t.is('another/c', c.name);\n                    t.is('another/minor', c.minorName);\n                }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"mapConfigStar-tests\", function(){});\n"
  },
  {
    "path": "tests/mapConfig/mapConfigStarAdapter.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Map Config Star Adapter Built Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"mapConfigStarAdapter.js\"></script>\n</head>\n<body>\n    <h1>alameda: Map Config Star Adapter Built Test</h1>\n    <p>Test using '*' with an adapter in the built map config.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/mapConfig/mapConfigStarAdapter.js",
    "content": "\ndefine('d',{\n    name: 'd'\n});\n\ndefine('adapter/d',['d'], function(d) {\n    d.adapted = true;\n    return d;\n});\n\ndefine('e',['d'], function (d) {\n    return {\n        name: 'e',\n        d: d\n    };\n});\n\n/*global doh */\nrequire({\n        baseUrl: './',\n        map: {\n            '*': {\n                'd': 'adapter/d'\n            },\n            'adapter/d': {\n                d: 'd'\n            }\n        }\n    },\n    ['e', 'adapter/d'],\n    function(e, adapterD) {\n        \n        doh.register(\n            'mapConfigStarAdapter',\n            [\n                function mapConfigStarAdapter(t){\n                    t.is('e', e.name);\n                    t.is('d', e.d.name);\n                    t.is(true, e.d.adapted);\n                    t.is(true, adapterD.adapted);\n                    t.is('d', adapterD.name);\n                }\n            ]\n        );\n        doh.run();\n    }\n);\n\ndefine(\"mapConfigStarAdapter-tests\", function(){});\n"
  },
  {
    "path": "tests/moduleConfig/moduleConfig.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: moduleConfig Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"moduleConfig.js\"></script>\n    <script type=\"text/javascript\">\n\tvar master = new doh.Deferred();\n\n        requirejs.config({\n            config: {\n                'foo': {\n                    locale: 'en-us'\n                },\n                'bar': {\n                    color: 'blue'\n                }\n            }\n        });\n\n        require(['foo', 'bar', 'baz'], function(foo, bar, baz) {\n            doh.register('moduleConfig',\n                [{\n                    name: 'moduleConfig',\n                    timeout: 2000,\n                    runTest: function() {\n                        doh.is('en-us', foo.locale);\n                        doh.is('blue', bar.color);\n                        doh.is(undefined, baz.doesNotExist);\n                    }\n                }]\n            );\n            doh.run();\n\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: moduleConfig Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/moduleConfig/moduleConfig.js",
    "content": "\ndefine('foo', function (require, exports, module) {\n    return {\n        locale: module.config().locale\n    };\n});\n\ndefine('bar', ['module'], function (module) {\n    return {\n        color: module.config().color\n    };\n});\n\ndefine('baz', ['module'], function (module) {\n    return {\n        doesNotExist: module.config().doesNotExist\n    };\n});\n"
  },
  {
    "path": "tests/onNodeCreated/a.js",
    "content": "define(['b'], function (b) {\n  return {\n    name: 'a',\n    b: b\n  };\n});\n"
  },
  {
    "path": "tests/onNodeCreated/b.js",
    "content": "define({\n    name: 'b'\n});\n"
  },
  {
    "path": "tests/onNodeCreated/onNodeCreated.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Simple Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n        var nodeCreatedArgs = [];\n        requirejs.config({\n          onNodeCreated: function (node, config, id, url) {\n            nodeCreatedArgs.push([node, config, id, url]);\n          }\n        });\n\n        require(['a'], function(a) {\n          doh.register(\n              'onNodeCreated',\n              [\n                  function onNodeCreated(t){\n                      t.is('a', a.name);\n                      t.is('b', a.b.name);\n                      t.is(2, nodeCreatedArgs.length);\n\n                      var callOne = nodeCreatedArgs[0];\n                      t.is('a', callOne[0].getAttribute('data-requiremodule'));\n                      t.is(true, !!callOne[1].onNodeCreated);\n                      t.is('a', callOne[2]);\n                      t.is('./a.js', callOne[3]);\n\n                      var callTwo = nodeCreatedArgs[1];\n                      t.is('b', callTwo[0].getAttribute('data-requiremodule'));\n                      t.is(true, !!callTwo[1].onNodeCreated);\n                      t.is('b', callTwo[2]);\n                      t.is('./b.js', callTwo[3]);\n                  }\n              ]\n          );\n          doh.run();\n\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: onNodeCreated Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/coffee.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Coffee Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"coffee.js\"></script>\n    <script type=\"text/javascript\">\n    require([\"cs!csmain\"],\n        function(csmain) {\n            doh.register(\n                \"coffee\",\n                [\n                    function coffee(t){\n                        t.is('dom:<b>This is a rendered view</b>', csmain);\n                    }\n                ]\n            );\n            doh.run();\n        }\n    );\n    </script>\n</head>\n<body>\n    <h1>alameda: Coffee Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/coffee.js",
    "content": "\n/**\n * @license cs 0.2.1 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/requirejs/require-cs for details\n *\n * CoffeeScript is Copyright (c) 2011 Jeremy Ashkenas\n * http://jashkenas.github.com/coffee-script/\n * CoffeeScriptVersion: '1.1.1'\n */\n\n/* Yes, deliciously evil. */\n/*jslint evil: true, strict: false, plusplus: false, regexp: false */\n/*global require: false, XMLHttpRequest: false, ActiveXObject: false,\n  define: false, process: false, window: false */\n\n(function () {\n\n\n    define('cs',{\n\n\n        version: '0.2.1',\n\n        load: function (name, parentRequire, load, config) {\n                    }\n    });\n\n}());\n(function() {\n  define('cs!controller',{\n    attach: function(view) {\n      //return require.ready(function() {\n        return view.render();\n      //});\n    }\n  });\n}).call(this);\n\n(function() {\n  define('cs!util',{\n    toDom: function(text) {\n      return 'dom:' + text;\n    }\n  });\n}).call(this);\n\n(function() {\n  define('cs!view',['cs!util'], function(util) {\n    return {\n      render: function(body) {\n        return util.toDom('<b>This is a rendered view</b>');\n      }\n    };\n  });\n}).call(this);\n\n(function() {\n  define('cs!csmain',['cs!controller', 'cs!view'], function(controller, view) {\n    return controller.attach(view);\n  });\n}).call(this);\n\nrequire({\n  paths: {\n    cs: '../../cs'\n  }\n}, ['cs!csmain']);\n\ndefine(\"main\", function(){});\n"
  },
  {
    "path": "tests/plugins/pluginMapSameName/pluginMapSameName.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Plugin Map Same Name Test</title>\n    <script type=\"text/javascript\" src=\"../../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../doh/_browserRunner.js\"></script>\n    <script src=\"../../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"pluginMapSameName.js\"></script>\n</head>\n<body>\n    <h1>alameda: Plugin Map Same Name Test</h1>\n    <p>Test using the map config with plugins. but include a map value that\n        contains the original name of the plugin, to confirm the map translation\n        is only done once:\n    <a href=\"https://github.com/requirejs/requirejs/issues/484\">484</a></p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/pluginMapSameName/pluginMapSameName.js",
    "content": "\ndefine('plugin/plugin',{\n    load: function (id, require, load, config) {\n        load(id);\n    }\n});\n\n\nrequire({\n    map: {\n        '*': {\n            'plugin': 'plugin/plugin'\n        }\n    }\n}, ['plugin!foo'], function (value) {\n\n    doh.register(\n        'pluginMapSameName',\n        [\n            function pluginMapSameName(t){\n                t.is('foo', value);\n            }\n        ]\n    );\n    doh.run();\n\n});\n\ndefine(\"pluginMapSameName-tests\", function(){});\n"
  },
  {
    "path": "tests/plugins/plugins.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Simple Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"plugins.js\"></script>\n    <script type=\"text/javascript\">\n        requirejs.config({\n                baseUrl: \"./\"\n        });\n        requirejs(['earth', 'prime/earth'],\n        function   (earth,   primeEarth) {\n\n            doh.register(\n                \"plugins\",\n                [\n                    function plugins(t){\n                        t.is(\"a\", earth.getA().name);\n                        t.is(\"c\", earth.getC().name);\n                        t.is(\"b\", earth.getB().name);\n                        t.is(\"aPrime\", primeEarth.getA().name);\n                        t.is(\"cPrime\", primeEarth.getC().name);\n                        t.is(\"bPrime\", primeEarth.getB().name);\n                     }\n                ]\n            );\n            doh.run();\n        });\n\n\n\n\n\n    </script>\n</head>\n<body>\n    <h1>alameda: Simple Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/plugins.js",
    "content": "\n(function () {\n\n    function parse(name) {\n        var parts = name.split('?'),\n            index = parseInt(parts[0], 10),\n            choices = parts[1].split(':'),\n            choice = choices[index];\n\n        return {\n            index: index,\n            choices: choices,\n            choice: choice\n        };\n    }\n\n    define('index',{\n        pluginBuilder: './indexBuilder',\n        normalize: function (name, normalize) {\n            var parsed = parse(name),\n                choices = parsed.choices;\n\n            //Normalize each path choice.\n            for (i = 0; i < choices.length; i++) {\n                choices[i] = normalize(choices[i]);\n            }\n\n            return parsed.index + '?' + choices.join(':');\n        },\n\n        load: function (name, req, load, config) {\n            req([parse(name).choice], function (value) {\n                load(value);\n            });\n        }\n    });\n\n}());\n\ndefine('a',{\n    name: 'a'\n});\n\ndefine('c',{\n    name: \"c\"\n});\n\ndefine('b',[],function () {\n    return {\n        name: \"b\"\n    };\n});\n\ndefine('earth',['require','./index!0?./a:./b:./c','./index!2?./a:./b:./c','./index!1?./a:./b:./c'],function (require) {\n   return {\n        getA: function () {\n            return require(\"./index!0?./a:./b:./c\");\n        },\n        getC: function () {\n            return require(\"./index!2?./a:./b:./c\");\n        },\n        getB: function () {\n            return require(\"./index!1?./a:./b:./c\");\n        }\n   };\n});\n\ndefine('prime/a',{\n    name: 'aPrime'\n});\n\ndefine('prime/c',{\n    name: \"cPrime\"\n});\n\ndefine('prime/b',[],function () {\n    return {\n        name: \"bPrime\"\n    };\n});\n\ndefine('prime/earth',['require','../index!0?./a:./b:./c','../index!2?./a:./b:./c','../index!1?./a:./b:./c'],function (require) {\n   return {\n        getA: function () {\n            return require(\"../index!0?./a:./b:./c\");\n        },\n        getC: function () {\n            return require(\"../index!2?./a:./b:./c\");\n        },\n        getB: function () {\n            return require(\"../index!1?./a:./b:./c\");\n        }\n   };\n});\n"
  },
  {
    "path": "tests/plugins/pluginsConfig/pluginsConfig.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Plugin Load Config Test</title>\n    <script type=\"text/javascript\" src=\"../../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../doh/_browserRunner.js\"></script>\n    <script src=\"../../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"pluginsConfig.js\"></script>\n</head>\n<body>\n    <h1>alameda: Plugin Load Config Test</h1>\n    <p>Test passing the loader config to the .load() method on the plugin, to\n    match the behavior of requirejs.</p>\n    <a href=\"https://github.com/requirejs/alameda/issues/10\">More info</a>.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/pluginsConfig/pluginsConfig.js",
    "content": "var expectedConfig;\n\ndefine('plugin/plugin',{\n    load: function (id, require, load, config) {\n        expectedConfig = config;\n        load(id);\n    }\n});\n\n\nrequire({\n    foo: 'bar',\n    map: {\n        '*': {\n            'plugin': 'plugin/plugin'\n        }\n    }\n}, ['plugin!foo'], function (value) {\n\n    doh.register(\n        'pluginsConfig',\n        [\n            function pluginsConfig(t){\n                t.is('bar', expectedConfig.foo);\n            }\n        ]\n    );\n    doh.run();\n\n});\n"
  },
  {
    "path": "tests/plugins/text.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Text Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"text.js\"></script>\n    <script type=\"text/javascript\">\n    require(\n        [\"require\", \"widget\"],\n        function(require, widget) {\n            doh.register(\n                \"text\",\n                [\n                    function text(t){\n                        t.is('<div data-type=\"widget\"><h1>This is a widget!</h1><p>I am in a widget</p></div>', widget.template);\n                        t.is('subwidget', widget.subWidgetName);\n                        t.is('<div data-type=\"subwidget\"><h1>This is a subwidget</h1></div>', widget.subWidgetTemplate);\n                        t.is('<span>This! is template2</span>', widget.subWidgetTemplate2);\n                    }\n                ]\n            );\n            doh.run();\n        }\n    );\n    </script>\n</head>\n<body>\n    <h1>alameda: Text Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/plugins/text.js",
    "content": "\n/**\n * @license RequireJS text 0.26.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or new BSD license.\n * see: http://github.com/jrburke/requirejs for details\n */\n/*jslint regexp: false, nomen: false, plusplus: false, strict: false */\n/*global require: false, XMLHttpRequest: false, ActiveXObject: false,\n  define: false, window: false, process: false, Packages: false,\n  java: false, location: false */\n\n(function () {\n    var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],\n        xmlRegExp = /^\\s*<\\?xml(\\s)+version=[\\'\\\"](\\d)*.(\\d)*[\\'\\\"](\\s)*\\?>/im,\n        bodyRegExp = /<body[^>]*>\\s*([\\s\\S]+)\\s*<\\/body>/im,\n        hasLocation = typeof location !== 'undefined' && location.href,\n        buildMap = [];\n\n    define('text',[],function () {\n        var text, get, fs;\n\n        if (typeof window !== \"undefined\" && window.navigator && window.document) {\n            get = function (url, callback) {\n                var xhr = text.createXhr();\n                xhr.open('GET', url, true);\n                xhr.onreadystatechange = function (evt) {\n                    //Do not explicitly handle errors, those should be\n                    //visible via console output in the browser.\n                    if (xhr.readyState === 4) {\n                        callback(xhr.responseText);\n                    }\n                };\n                xhr.send(null);\n            };\n        } else if (typeof process !== \"undefined\" &&\n                 process.versions &&\n                 !!process.versions.node) {\n            //Using special require.nodeRequire, something added by r.js.\n            fs = require.nodeRequire('fs');\n\n            get = function (url, callback) {\n                callback(fs.readFileSync(url, 'utf8'));\n            };\n        } else if (typeof Packages !== 'undefined') {\n            //Why Java, why is this so awkward?\n            get = function (url, callback) {\n                var encoding = \"utf-8\",\n                    file = new java.io.File(url),\n                    lineSeparator = java.lang.System.getProperty(\"line.separator\"),\n                    input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),\n                    stringBuffer, line,\n                    content = '';\n                try {\n                    stringBuffer = new java.lang.StringBuffer();\n                    line = input.readLine();\n\n                    // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324\n                    // http://www.unicode.org/faq/utf_bom.html\n\n                    // Note that when we use utf-8, the BOM should appear as \"EF BB BF\", but it doesn't due to this bug in the JDK:\n                    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058\n                    if (line && line.length() && line.charAt(0) === 0xfeff) {\n                        // Eat the BOM, since we've already found the encoding on this file,\n                        // and we plan to concatenating this buffer with others; the BOM should\n                        // only appear at the top of a file.\n                        line = line.substring(1);\n                    }\n\n                    stringBuffer.append(line);\n\n                    while ((line = input.readLine()) !== null) {\n                        stringBuffer.append(lineSeparator);\n                        stringBuffer.append(line);\n                    }\n                    //Make sure we return a JavaScript string and not a Java string.\n                    content = String(stringBuffer.toString()); //String\n                } finally {\n                    input.close();\n                }\n                callback(content);\n            };\n        }\n\n        text = {\n            version: '0.26.0',\n\n            strip: function (content) {\n                //Strips <?xml ...?> declarations so that external SVG and XML\n                //documents can be added to a document without worry. Also, if the string\n                //is an HTML document, only the part inside the body tag is returned.\n                if (content) {\n                    content = content.replace(xmlRegExp, \"\");\n                    var matches = content.match(bodyRegExp);\n                    if (matches) {\n                        content = matches[1];\n                    }\n                } else {\n                    content = \"\";\n                }\n                return content;\n            },\n\n            jsEscape: function (content) {\n                return content.replace(/(['\\\\])/g, '\\\\$1')\n                    .replace(/[\\f]/g, \"\\\\f\")\n                    .replace(/[\\b]/g, \"\\\\b\")\n                    .replace(/[\\n]/g, \"\\\\n\")\n                    .replace(/[\\t]/g, \"\\\\t\")\n                    .replace(/[\\r]/g, \"\\\\r\");\n            },\n\n            createXhr: function () {\n                //Would love to dump the ActiveX crap in here. Need IE 6 to die first.\n                var xhr, i, progId;\n                if (typeof XMLHttpRequest !== \"undefined\") {\n                    return new XMLHttpRequest();\n                } else {\n                    for (i = 0; i < 3; i++) {\n                        progId = progIds[i];\n                        try {\n                            xhr = new ActiveXObject(progId);\n                        } catch (e) {}\n\n                        if (xhr) {\n                            progIds = [progId];  // so faster next time\n                            break;\n                        }\n                    }\n                }\n\n                if (!xhr) {\n                    throw new Error(\"createXhr(): XMLHttpRequest not available\");\n                }\n\n                return xhr;\n            },\n\n            get: get,\n\n            /**\n             * Parses a resource name into its component parts. Resource names\n             * look like: module/name.ext!strip, where the !strip part is\n             * optional.\n             * @param {String} name the resource name\n             * @returns {Object} with properties \"moduleName\", \"ext\" and \"strip\"\n             * where strip is a boolean.\n             */\n            parseName: function (name) {\n                var strip = false, index = name.indexOf(\".\"),\n                    modName = name.substring(0, index),\n                    ext = name.substring(index + 1, name.length);\n\n                index = ext.indexOf(\"!\");\n                if (index !== -1) {\n                    //Pull off the strip arg.\n                    strip = ext.substring(index + 1, ext.length);\n                    strip = strip === \"strip\";\n                    ext = ext.substring(0, index);\n                }\n\n                return {\n                    moduleName: modName,\n                    ext: ext,\n                    strip: strip\n                };\n            },\n\n            xdRegExp: /^((\\w+)\\:)?\\/\\/([^\\/\\\\]+)/,\n\n            /**\n             * Is an URL on another domain. Only works for browser use, returns\n             * false in non-browser environments. Only used to know if an\n             * optimized .js version of a text resource should be loaded\n             * instead.\n             * @param {String} url\n             * @returns Boolean\n             */\n            canUseXhr: function (url, protocol, hostname, port) {\n                var match = text.xdRegExp.exec(url),\n                    uProtocol, uHostName, uPort;\n                if (!match) {\n                    return true;\n                }\n                uProtocol = match[2];\n                uHostName = match[3];\n\n                uHostName = uHostName.split(':');\n                uPort = uHostName[1];\n                uHostName = uHostName[0];\n\n                return (!uProtocol || uProtocol === protocol) &&\n                       (!uHostName || uHostName === hostname) &&\n                       ((!uPort && !uHostName) || uPort === port);\n            },\n\n            finishLoad: function (name, strip, content, onLoad, config) {\n                content = strip ? text.strip(content) : content;\n                if (config.isBuild && config.inlineText) {\n                    buildMap[name] = content;\n                }\n                onLoad(content);\n            },\n\n            load: function (name, req, onLoad, config) {\n                //Name has format: some.module.filext!strip\n                //The strip part is optional.\n                //if strip is present, then that means only get the string contents\n                //inside a body tag in an HTML string. For XML/SVG content it means\n                //removing the <?xml ...?> declarations so the content can be inserted\n                //into the current doc without problems.\n\n                var parsed = text.parseName(name),\n                    nonStripName = parsed.moduleName + '.' + parsed.ext,\n                    url = req.toUrl(nonStripName);\n\n                //Load the text. Use XHR if possible and in a browser.\n                if (!hasLocation || text.canUseXhr(url)) {\n                    text.get(url, function (content) {\n                        text.finishLoad(name, parsed.strip, content, onLoad, config);\n                    });\n                } else {\n                    //Need to fetch the resource across domains. Assume\n                    //the resource has been optimized into a JS module. Fetch\n                    //by the module name + extension, but do not include the\n                    //!strip part to avoid file system issues.\n                    req([nonStripName], function (content) {\n                        text.finishLoad(parsed.moduleName + '.' + parsed.ext,\n                                        parsed.strip, content, onLoad, config);\n                    });\n                }\n            },\n\n            write: function (pluginName, moduleName, write, config) {\n                if (moduleName in buildMap) {\n                    var content = text.jsEscape(buildMap[moduleName]);\n                    write(\"define('\" + pluginName + \"!\" + moduleName  +\n                          \"', function () { return '\" + content + \"';});\\n\");\n                }\n            },\n\n            writeFile: function (pluginName, moduleName, req, write, config) {\n                var parsed = text.parseName(moduleName),\n                    nonStripName = parsed.moduleName + '.' + parsed.ext,\n                    //Use a '.js' file name so that it indicates it is a\n                    //script that can be loaded across domains.\n                    fileName = req.toUrl(parsed.moduleName + '.' +\n                                         parsed.ext) + '.js';\n\n                //Leverage own load() method to load plugin value, but only\n                //write out values that do not have the strip argument,\n                //to avoid any potential issues with ! in file names.\n                text.load(nonStripName, req, function (value) {\n                    //Use own write() method to construct full module value.\n                    text.write(pluginName, nonStripName, function (contents) {\n                        write(fileName, contents);\n                    }, config);\n                }, config);\n            }\n        };\n\n        return text;\n    });\n}());\ndefine('text!subwidget.html!strip', function () { return '<div data-type=\"subwidget\"><h1>This is a subwidget</h1></div>';});\ndefine('text!subwidget2.html', function () { return '<span>This! is template2</span>';});\n\ndefine(\"subwidget\",\n  [\"text!subwidget.html!strip\", \"text!subwidget2.html\"],\n  function(template, template2) {\n    return {\n      name: \"subwidget\",\n      template: template,\n      template2: template2\n    };\n  }\n);\ndefine('text!widget.html', function () { return '<div data-type=\"widget\"><h1>This is a widget!</h1><p>I am in a widget</p></div>';});\n\ndefine(\"widget\",\n  [\"subwidget\", \"text!widget.html\"],\n  function(subwidget, template) {\n    return {\n      subWidgetName: subwidget.name,\n      subWidgetTemplate: subwidget.template,\n      subWidgetTemplate2: subwidget.template2,\n      template: template\n    };\n  }\n);\n"
  },
  {
    "path": "tests/preserveDeps/preserveDeps.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: preserveDeps Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n\t\tdefine('a', function(){});\n\t\tdefine('b', function(){});\n\n\t\tvar x = ['a', 'b'];\n\n\t\trequire(x, function() {\n\t\t\tdoh.register(\n                'preserveDeps',\n                [\n                    function preserveDeps(t){\n                        t.is('a', x[0]);\n                        t.is('b', x[1]);\n                    }\n                ]\n            );\n            doh.run();\n\t\t});\n    </script>\n</head>\n<body>\n    <h1>alameda: preserveDeps Test</h1>\n\n    <p>alameda should not mutate deps passed to it. More info:\n    <a href=\"https://github.com/requirejs/alameda/issues/35\">35</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/promiseRequire/app.js",
    "content": "define(['bar'], function (bar) {\n  return {\n    name: 'app',\n    bar: bar\n  };\n});\n\n"
  },
  {
    "path": "tests/promiseRequire/bar.js",
    "content": "// bar.js\ndefine('bar', function(require) {\n    return {\n      name: 'bar'\n    };\n});\n\n"
  },
  {
    "path": "tests/promiseRequire/promiseRequire.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: promise from require</title>\n    <script src=\"../doh/runner.js\"></script>\n    <script src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script>\n\n    require.config({\n        defaultErrback: null\n    });\n\n    var doneCount = 0;\n    var doneMax = 5;\n    var master = new doh.Deferred();\n    function done(err) {\n        if (err) {\n          return master.errback(err);\n        }\n\n        doneCount += 1;\n        if (doneCount === doneMax) {\n            master.callback(true);\n        }\n    }\n\n    // then with no initial callback.\n    require(['app'], function(app) {\n        doh.is('app', app.name);\n        doh.is('bar', app.bar.name);\n        return 'whatevs';\n    }).then(function(value) {\n        doh.is('whatevs', value);\n        done();\n    });\n\n    // then with no initial callback.\n    require(['app']).then(function(mods) {\n        var app = mods[0];\n        doh.is('app', app.name);\n        doh.is('bar', app.bar.name);\n        done();\n    });\n\n\n    // then with errback getting the original success callback error.\n    require(['app'], function(app) {\n        doh.is('app', app.name);\n        doh.is('bar', app.bar.name);\n        throw new Error('Error inside a callback');\n    }).then(function(value) {\n        console.error('WHAT 1', value);\n        done(value);\n    }, function(err) {\n        doh.is(true, !!err);\n        done();\n    });\n\n    // Initial errback getting error from success callback, and subsequent\n    // .then gets the success path if errback does not error.\n    require(['app'], function(app) {\n        doh.is('app', app.name);\n        doh.is('bar', app.bar.name);\n        throw new Error('Error inside a callback');\n    }, function (err) {\n        console.log('Expected to get here');\n        doh.is(true, !!err);\n    }).then(function(value) {\n        console.error('WHAT 3', value);\n        done(value);\n    }, function(err) {\n        doh.is(true, !!err);\n        done();\n    });\n\n    // catch usage.\n    require(['app'], function(app) {\n        doh.is('app', app.name);\n        doh.is('bar', app.bar.name);\n        throw new Error('Error inside a callback');\n    }).catch(function(err) {\n        doh.is(true, !!err);\n        done();\n    });\n\n\n    // No catch, see if the browser prints out unhandled promises with errors.\n    // Not part of the test.\n    // require(['app'], function(app) {\n    //     doh.is('app', app.name);\n    //     doh.is('bar', app.bar.name);\n    //     throw new Error('Error inside a callback');\n    // });\n\n\n    //Register the test\n    doh.register(\n        \"promiseRequire\",\n        [\n            {\n                name: \"promiseRequire\",\n                timeout: 3000,\n                runTest: function () {\n                    return master;\n                }\n            }\n        ]\n    );\n    doh.run();\n    </script>\n</head>\n<body>\n    <h1>alameda: promise from require</h1>\n\n    <p>Test require([]) returning a promise.\n    <a href=\"https://github.com/requirejs/alameda/issues/8\">More info</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/relativePaths/relativePaths.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: relativePaths Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n        define('fu/a', [], function(){\n            return {\n                name: 'fu/a'\n            };\n        });\n\n        define('foo/bar/c',['../../fu/a'], function(v){\n            return {\n                name: 'foo/bar/c',\n                fuA: v\n            };\n        });\n\n        define('foo/b',['./bar/c'], function(v){\n            return {\n                name: 'foo/b',\n                barC: v\n            };\n        });\n\n        define('../../ext',[], function(){\n            return {\n                name: 'ext'\n            };\n        });\n\n        define('main', ['./foo/b', '../../ext'], function(v, e){\n            return {\n                name: 'main',\n                fooB: v,\n                ext: e\n            };\n        });\n\n        require(['main'], function(main){\n            doh.register(\n                'relativePaths',\n                [\n                    function relativePaths(t){\n                        t.is('main', main.name);\n                        t.is('foo/b', main.fooB.name);\n                        t.is('foo/bar/c', main.fooB.barC.name);\n                        t.is('fu/a', main.fooB.barC.fuA.name);\n                        t.is('ext', main.ext.name);\n                    }\n                ]\n            );\n            doh.run();\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: Relative Paths Test</h1>\n\n    <p>Test relative dependency paths with alameda. More info:\n    <a href=\"https://github.com/requirejs/almond/issues/28\">28</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/runner.js",
    "content": "var page = require('webpage').create();\n\npage.onAlert = function () {\n    if (page.evaluate(function () { return doh._doneForPhantom; })) {\n        var problems = page.evaluate(function () {\n            return doh._errorCount + doh._failureCount;\n        });\n        phantom.exit(problems ? 1 : 0);\n    }\n};\n\nvar first = true;\npage.onLoadFinished = function (status) {\n    if (first) {\n        first = false;\n        page.evaluate(function () {\n            var oldReport = doh._report;\n            doh._report = function () {\n            \toldReport.apply(doh, arguments);\n            \tthis._doneForPhantom = true;\n            \talert();\n            };\n            doh.run();\n        });\n    }\n};\n\npage.onConsoleMessage = function () {\n    console.log.apply(console, arguments);\n};\n\npage.open('http://localhost:1986/tests/doh/runner.html?testUrl=../all');\n"
  },
  {
    "path": "tests/server.js",
    "content": "var connect = require('connect');\nconnect.createServer(connect.static(__dirname + '/..')).listen(1986);\nrequire('fs').writeFileSync(__dirname + '/pid.txt', process.pid);\n"
  },
  {
    "path": "tests/shim/shim.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Shim Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"shim.js\"></script>\n    <script type=\"text/javascript\">\n\tvar master = new doh.Deferred();\n\n        require({\n                baseUrl: './',\n            },\n            ['a', 'c', 'e'],\n            function(a, c, e) {\n                doh.register(\n                    'shimBasic',\n                    [\n                        function shimBasic(t){\n                            t.is('a', a);\n                            t.is('a', c.b.aValue);\n                            t.is('b', c.b.name);\n                            t.is('c', c.name);\n                            t.is('d', c.b.dValue.name);\n                            t.is('e', e.name);\n                        }\n                    ]\n                );\n                doh.run();\n            }\n        );\n\n    </script>\n</head>\n<body>\n    <h1>alameda: moduleConfig Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/shim/shim.js",
    "content": "//Taken from requirejs/tests/shim/built/basic-tests.js\n\n(function (root) {\n    root.A = {\n        name: 'a'\n    };\n}(this));\n\ndefine(\"a\", (function (global) {\n    return function () {\n        var ret = global.A.name;\n       var fn = function () {\n                    window.globalA = this.A.name;\n                };\n        fn.apply(global, arguments);\n        return ret;\n    };\n}(this)));\n\nfunction D() {\n    this.name = 'd';\n};\n\ndefine(\"d\", function(){});\n\nvar B = {\n    name: 'b',\n    aValue: A.name,\n    dValue: new D()\n};\n\ndefine(\"b\", function(){});\n\nvar C = {\n    name: 'c',\n    a: A,\n    b: B\n};\n\ndefine(\"c\", [\"a\",\"b\"], (function (global) {\n    return function () {\n        var ret = global.C;\n        return ret;\n    };\n}(this)));\n\nvar e = {\n    nested: {\n        e: {\n            name: 'e'\n        }\n    }\n};\n\ndefine(\"e\", (function (global) {\n    return function () {\n        var ret = global.e.nested.e;\n        return ret;\n    };\n}(this)));\n"
  },
  {
    "path": "tests/simple.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Simple Test</title>\n    <script type=\"text/javascript\" src=\"doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"doh/_browserRunner.js\"></script>\n    <script src=\"../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"simple.js\"></script>\n    <script type=\"text/javascript\">\n\tvar master = new doh.Deferred();\n\n        require(['foo', 'bar', 'baz'], function(foo, bar, baz) {\n            doh.register('simple',\n                [{\n                    name: 'simple',\n                    timeout: 2000,\n                    runTest: function() {\n                        doh.is('foo', foo.name);\n                        doh.is('bar', bar.name);\n                        doh.is('baz', baz.name);\n                        doh.is('bar', baz.barName);\n                        baz.callIt(function (bar) {\n                            doh.is('bar', bar.name);\n                            master.callback(true);\n                        });\n                    }\n                }]\n            );\n            doh.run();\n\n        });\n    </script>\n</head>\n<body>\n    <h1>alameda: Simple Test</h1>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/simple.js",
    "content": "\ndefine('foo', {\n    name: 'foo'\n});\n\ndefine('bar', [], function() {\n    return {\n        name: 'bar'\n    }\n});\n\ndefine('baz', ['require', 'exports', 'module', './bar'], function (require, exports, module) {\n    var bar = require('./bar');\n\n    exports.name = 'baz';\n    exports.barName = bar.name;\n\n    exports.callIt = function (callback) {\n        require(['./bar'], function (bar) {\n            callback(bar);\n        });\n    }\n});\n"
  },
  {
    "path": "tests/specialDeps/specialDeps-tests.js",
    "content": "define('foo', function(require, exports, module) {\n    require('exports').name = 'foo';\n    require('require')('exports').related = require('module').config().related;\n    require('require')('exports').uri = module.uri;\n});\n\nrequire.config({\n    config: {\n        foo: {\n            related: 'bar'\n        }\n    }\n});\n\nrequire([\"foo\"], function (foo) {\n    doh.register(\n        \"specialDeps\",\n        [\n            function specialDeps(t) {\n                t.is(\"foo\", foo.name);\n                t.is(\"bar\", foo.related);\n                t.is(\"./foo.js\", foo.uri);\n            }\n        ]\n    );\n    doh.run();\n});\n"
  },
  {
    "path": "tests/specialDeps/specialDeps.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Special Dependencies Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script type=\"text/javascript\" src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\" src=\"specialDeps-tests.js\"></script>\n</head>\n<body>\n    <h1>alameda: Special Dependencies Test</h1>\n\n    <p>Tests for require(\"require\"|\"exports\"|\"module\") inside a module.\n        <a href=\"https://github.com/requirejs/requirejs/issues/409\">More info</a>.</p>\n\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  },
  {
    "path": "tests/timeoutErrors/timeoutErrors.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <title>alameda: Errors Test</title>\n    <script type=\"text/javascript\" src=\"../doh/runner.js\"></script>\n    <script type=\"text/javascript\" src=\"../doh/_browserRunner.js\"></script>\n    <script src=\"../../alameda.js\"></script>\n    <script type=\"text/javascript\">\n      define('slowLoad', function() {\n        return {\n          load: function (name, req, onload, config) {\n            setTimeout(function() {\n              onload({\n                name: name\n              });\n            }, 10000);\n          }\n        }\n      });\n\n\t    var master = new doh.Deferred(),\n          count = 0;\n\n      function done() {\n          count += 1;\n          if (count === 3) {\n              master.callback(true);\n          }\n      }\n\n      doh.register('timeoutErrors',\n          [{\n              name: 'timeoutErrors',\n              timeout: 2000,\n              runTest: function() {\n                return master;\n              }\n          }]\n      );\n      doh.run();\n\n      var req = requirejs.config({\n        waitSeconds: .0001\n      });\n\n      var onErrorCalls = 0;\n      req.onError = function(e){\n        onErrorCalls += 1;\n        doh.is(1, onErrorCalls);\n        doh.is(e.requireModules, ['slowLoad!foo']);\n        doh.is(e.requireType, 'timeout');\n\n        done();\n      };\n\n      req(['slowLoad!foo'],\n        function () {\n          doh.is(false, true);\n        },\n        function (err) {\n          doh.is(err.requireModules, ['slowLoad!foo']);\n          doh.is(err.requireType, 'timeout');\n          done();\n        }\n      );\n      req(\n        ['slowLoad!foo'],\n        function () {\n          doh.is(false, true);\n        },\n        function (err) {\n          doh.is(err.requireModules, ['slowLoad!foo']);\n          doh.is(err.requireType, 'timeout');\n          done();\n        }\n      );\n\n      req(\n        ['slowLoad!foo'],\n        function (a) {\n          doh.is(false, true);\n        }\n      );\n    </script>\n</head>\n<body>\n    <h1>alameda: Errors Test</h1>\n    <p>Tests that timeouts trigger errbacks if appropriate, require.onError if\n    no errback is provided.</p>\n    <p>Check console for messages</p>\n</body>\n</html>\n"
  }
]