http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/package.json ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/package.json b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/package.json new file mode 100644 index 0000000..bede0fb --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/package.json @@ -0,0 +1,71 @@ +{ + "name": "resumer", + "version": "0.0.0", + "description": "a through stream that starts paused and resumes on the next tick", + "main": "index.js", + "dependencies": { + "through": "~2.3.4" + }, + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "concat-stream": "~0.1.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/resumer.git" + }, + "homepage": "https://github.com/substack/resumer", + "keywords": [ + "through", + "stream", + "pause", + "resume" + ], + "author": { + "name": "James Halliday", + "email": "[email protected]", + "url": "http://substack.net" + }, + "license": "MIT", + "readme": "# resumer\n\nReturn a through stream that starts out paused and resumes on the next tick,\nunless somebody called `.pause()`.\n\nThis module has the same signature as\n[through](https://npmjs.com/package/through).\n\n[](http://ci.testling.com/substack/resumer)\n\n[](http://travis-ci.org/substack/resumer)\n\n# example\n\n``` js\nvar resumer = require('resumer');\nvar s = createStream();\ns.pipe(process.stdout);\n\nfunction createStream () {\n var stream = resumer();\n stream.queue('beep boop\\n');\n return stream;\n}\n```\n\n```\n$ node example/resume.js\nbeep boop\n```\n\n# methods\n\n``` js\nvar resumer = require('resumer')\n```\n\n## resumer(write, end)\n\nReturn a new through stream from `write` and `end`, which default to\npass-through `.queue()` functions if not specified.\n\nThe stream starts out paused and will be resumed on t he next tick unless you\ncall `.pause()` first.\n\n`write` and `end` get passed directly through to\n[through](https://npmjs.com/package/through).\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install resumer\n```\n\n# license\n\nMIT\n", + "readmeFilename": "readme.markdown", + "_id": "[email protected]", + "dist": { + "shasum": "f1e8f461e4064ba39e82af3cdc2a8c893d076759", + "tarball": "http://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz" + }, + "_from": "resumer@~0.0.0", + "_npmVersion": "1.2.2", + "_npmUser": { + "name": "substack", + "email": "[email protected]" + }, + "maintainers": [ + { + "name": "substack", + "email": "[email protected]" + } + ], + "directories": {}, + "_shasum": "f1e8f461e4064ba39e82af3cdc2a8c893d076759", + "_resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "bugs": { + "url": "https://github.com/substack/resumer/issues" + } +}
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/readme.markdown ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/readme.markdown b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/readme.markdown new file mode 100644 index 0000000..5d9df66 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/readme.markdown @@ -0,0 +1,59 @@ +# resumer + +Return a through stream that starts out paused and resumes on the next tick, +unless somebody called `.pause()`. + +This module has the same signature as +[through](https://npmjs.com/package/through). + +[](http://ci.testling.com/substack/resumer) + +[](http://travis-ci.org/substack/resumer) + +# example + +``` js +var resumer = require('resumer'); +var s = createStream(); +s.pipe(process.stdout); + +function createStream () { + var stream = resumer(); + stream.queue('beep boop\n'); + return stream; +} +``` + +``` +$ node example/resume.js +beep boop +``` + +# methods + +``` js +var resumer = require('resumer') +``` + +## resumer(write, end) + +Return a new through stream from `write` and `end`, which default to +pass-through `.queue()` functions if not specified. + +The stream starts out paused and will be resumed on the next tick unless you +call `.pause()` first. + +`write` and `end` get passed directly through to +[through](https://npmjs.com/package/through). + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install resumer +``` + +# license + +MIT http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/resume.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/resume.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/resume.js new file mode 100644 index 0000000..1eaecac --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/resume.js @@ -0,0 +1,37 @@ +var test = require('tape'); +var resumer = require('../'); +var concat = require('concat-stream'); + +test('implicit resume', function (t) { + t.plan(1); + + var s = createStream(); + s.pipe(concat(function (err, body) { + t.equal(body, 'beep boop\n'); + })); +}); + +test('pause/resume', function (t) { + t.plan(2); + + var s = createStream(); + s.pause(); + + var paused = true; + setTimeout(function () { + paused = false; + s.resume(); + }, 100); + + s.pipe(concat(function (err, body) { + t.equal(paused, false); + t.equal(body, 'beep boop\n'); + })); +}); + +function createStream () { + var stream = resumer(); + stream.queue('beep boop\n'); + stream.queue(null); + return stream; +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/through.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/through.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/through.js new file mode 100644 index 0000000..ddcaf48 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/resumer/test/through.js @@ -0,0 +1,36 @@ +var test = require('tape'); +var resumer = require('../'); +var concat = require('concat-stream'); + +test('through write/end', function (t) { + t.plan(2); + + var s = createStream(); + + s.on('okok', function () { + t.ok(true); + }); + + s.pipe(concat(function (err, body) { + t.equal(body, 'BEGIN\nRAWR\nEND\n'); + })); + + setTimeout(function () { + s.end('rawr\n'); + }, 50); +}); + +function createStream () { + var stream = resumer(write, end); + stream.queue('BEGIN\n'); + return stream; + + function write (x) { + this.queue(String(x).toUpperCase()); + } + function end () { + this.emit('okok'); + this.queue('END\n'); + this.queue(null); + } +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/.travis.yml ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/.travis.yml b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/.travis.yml new file mode 100644 index 0000000..c693a93 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - "0.10" http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.APACHE2 ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.APACHE2 b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.APACHE2 new file mode 100644 index 0000000..6366c04 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.APACHE2 @@ -0,0 +1,15 @@ +Apache License, Version 2.0 + +Copyright (c) 2011 Dominic Tarr + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.MIT ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.MIT b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.MIT new file mode 100644 index 0000000..6eafbd7 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/LICENSE.MIT @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2011 Dominic Tarr + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/index.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/index.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/index.js new file mode 100644 index 0000000..ca5fc59 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/index.js @@ -0,0 +1,108 @@ +var Stream = require('stream') + +// through +// +// a stream that does nothing but re-emit the input. +// useful for aggregating a series of changing but not ending streams into one stream) + +exports = module.exports = through +through.through = through + +//create a readable writable stream. + +function through (write, end, opts) { + write = write || function (data) { this.queue(data) } + end = end || function () { this.queue(null) } + + var ended = false, destroyed = false, buffer = [], _ended = false + var stream = new Stream() + stream.readable = stream.writable = true + stream.paused = false + +// stream.autoPause = !(opts && opts.autoPause === false) + stream.autoDestroy = !(opts && opts.autoDestroy === false) + + stream.write = function (data) { + write.call(this, data) + return !stream.paused + } + + function drain() { + while(buffer.length && !stream.paused) { + var data = buffer.shift() + if(null === data) + return stream.emit('end') + else + stream.emit('data', data) + } + } + + stream.queue = stream.push = function (data) { +// console.error(ended) + if(_ended) return stream + if(data === null) _ended = true + buffer.push(data) + drain() + return stream + } + + //this will be registered as the first 'end' listener + //must call destroy next tick, to make sure we're after any + //stream piped from here. + //this is only a problem if end is not emitted synchronously. + //a nicer way to do this is to make sure this is the last listener for 'end' + + stream.on('end', function () { + stream.readable = false + if(!stream.writable && stream.autoDestroy) + process.nextTick(function () { + stream.destroy() + }) + }) + + function _end () { + stream.writable = false + end.call(stream) + if(!stream.readable && stream.autoDestroy) + stream.destroy() + } + + stream.end = function (data) { + if(ended) return + ended = true + if(arguments.length) stream.write(data) + _end() // will emit or queue + return stream + } + + stream.destroy = function () { + if(destroyed) return + destroyed = true + ended = true + buffer.length = 0 + stream.writable = stream.readable = false + stream.emit('close') + return stream + } + + stream.pause = function () { + if(stream.paused) return + stream.paused = true + return stream + } + + stream.resume = function () { + if(stream.paused) { + stream.paused = false + stream.emit('resume') + } + drain() + //may have become paused again, + //as drain emits 'data'. + if(!stream.paused) + stream.emit('drain') + return stream + } + return stream +} + http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/package.json ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/package.json b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/package.json new file mode 100644 index 0000000..a6d08b9 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/package.json @@ -0,0 +1,66 @@ +{ + "name": "through", + "version": "2.3.8", + "description": "simplified stream construction", + "main": "index.js", + "scripts": { + "test": "set -e; for t in test/*.js; do node $t; done" + }, + "devDependencies": { + "stream-spec": "~0.3.5", + "tape": "~2.3.2", + "from": "~0.1.3" + }, + "keywords": [ + "stream", + "streams", + "user-streams", + "pipe" + ], + "author": { + "name": "Dominic Tarr", + "email": "[email protected]", + "url": "dominictarr.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/dominictarr/through.git" + }, + "homepage": "https://github.com/dominictarr/through", + "testling": { + "browsers": [ + "ie/8..latest", + "ff/15..latest", + "chrome/20..latest", + "safari/5.1..latest" + ], + "files": "test/*.js" + }, + "gitHead": "2c5a6f9a0cc54da759b6e10964f2081c358e49dc", + "bugs": { + "url": "https://github.com/dominictarr/through/issues" + }, + "_id": "[email protected]", + "_shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5", + "_from": "through@~2.3.4", + "_npmVersion": "2.12.0", + "_nodeVersion": "2.3.1", + "_npmUser": { + "name": "dominictarr", + "email": "[email protected]" + }, + "maintainers": [ + { + "name": "dominictarr", + "email": "[email protected]" + } + ], + "dist": { + "shasum": "0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5", + "tarball": "http://registry.npmjs.org/through/-/through-2.3.8.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "readme": "ERROR: No README data found!" +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/readme.markdown ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/readme.markdown b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/readme.markdown new file mode 100644 index 0000000..cb34c81 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/readme.markdown @@ -0,0 +1,64 @@ +#through + +[](http://travis-ci.org/dominictarr/through) +[](https://ci.testling.com/dominictarr/through) + +Easy way to create a `Stream` that is both `readable` and `writable`. + +* Pass in optional `write` and `end` methods. +* `through` takes care of pause/resume logic if you use `this.queue(data)` instead of `this.emit('data', data)`. +* Use `this.pause()` and `this.resume()` to manage flow. +* Check `this.paused` to see current flow state. (`write` always returns `!this.paused`). + +This function is the basis for most of the synchronous streams in +[event-stream](http://github.com/dominictarr/event-stream). + +``` js +var through = require('through') + +through(function write(data) { + this.queue(data) //data *must* not be null + }, + function end () { //optional + this.queue(null) + }) +``` + +Or, can also be used _without_ buffering on pause, use `this.emit('data', data)`, +and this.emit('end') + +``` js +var through = require('through') + +through(function write(data) { + this.emit('data', data) + //this.pause() + }, + function end () { //optional + this.emit('end') + }) +``` + +## Extended Options + +You will probably not need these 99% of the time. + +### autoDestroy=false + +By default, `through` emits close when the writable +and readable side of the stream has ended. +If that is not desired, set `autoDestroy=false`. + +``` js +var through = require('through') + +//like this +var ts = through(write, end, {autoDestroy: false}) +//or like this +var ts = through(write, end) +ts.autoDestroy = false +``` + +## License + +MIT / Apache2 http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/async.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/async.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/async.js new file mode 100644 index 0000000..46bdbae --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/async.js @@ -0,0 +1,28 @@ +var from = require('from') +var through = require('../') + +var tape = require('tape') + +tape('simple async example', function (t) { + + var n = 0, expected = [1,2,3,4,5], actual = [] + from(expected) + .pipe(through(function(data) { + this.pause() + n ++ + setTimeout(function(){ + console.log('pushing data', data) + this.push(data) + this.resume() + }.bind(this), 300) + })).pipe(through(function(data) { + console.log('pushing data second time', data); + this.push(data) + })).on('data', function (d) { + actual.push(d) + }).on('end', function() { + t.deepEqual(actual, expected) + t.end() + }) + +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/auto-destroy.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/auto-destroy.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/auto-destroy.js new file mode 100644 index 0000000..9a8fd00 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/auto-destroy.js @@ -0,0 +1,30 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + ts.autoDestroy = false + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.notOk(closed) + ts.destroy() + assert.ok(closed) + assert.end() +}) + http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/buffering.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/buffering.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/buffering.js new file mode 100644 index 0000000..b0084bf --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/buffering.js @@ -0,0 +1,71 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('buffering', function(assert) { + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + assert.deepEqual(actual, [1, 2, 3]) + ts.pause() + ts.write(4) + ts.write(5) + ts.write(6) + assert.deepEqual(actual, [1, 2, 3]) + ts.resume() + assert.deepEqual(actual, [1, 2, 3, 4, 5, 6]) + ts.pause() + ts.end() + assert.ok(!ended) + ts.resume() + assert.ok(ended) + assert.end() +}) + +test('buffering has data in queue, when ends', function (assert) { + + /* + * If stream ends while paused with data in the queue, + * stream should still emit end after all data is written + * on resume. + */ + + var ts = through(function (data) { + this.queue(data) + }, function () { + this.queue(null) + }) + + var ended = false, actual = [] + + ts.on('data', actual.push.bind(actual)) + ts.on('end', function () { + ended = true + }) + + ts.pause() + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.deepEqual(actual, [], 'no data written yet, still paused') + assert.ok(!ended, 'end not emitted yet, still paused') + ts.resume() + assert.deepEqual(actual, [1, 2, 3], 'resumed, all data should be delivered') + assert.ok(ended, 'end should be emitted once all data was delivered') + assert.end(); +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/end.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/end.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/end.js new file mode 100644 index 0000000..fa113f5 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/end.js @@ -0,0 +1,45 @@ +var test = require('tape') +var through = require('../') + +// must emit end before close. + +test('end before close', function (assert) { + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + assert.ok(!closed) + ended = true + }) + ts.on('close', function () { + assert.ok(ended) + closed = true + }) + + ts.write(1) + ts.write(2) + ts.write(3) + ts.end() + assert.ok(ended) + assert.ok(closed) + assert.end() +}) + +test('end only once', function (t) { + + var ts = through() + var ended = false, closed = false + + ts.on('end', function () { + t.equal(ended, false) + ended = true + }) + + ts.queue(null) + ts.queue(null) + ts.queue(null) + + ts.resume() + + t.end() +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/index.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/index.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/index.js new file mode 100644 index 0000000..96da82f --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/node_modules/through/test/index.js @@ -0,0 +1,133 @@ + +var test = require('tape') +var spec = require('stream-spec') +var through = require('../') + +/* + I'm using these two functions, and not streams and pipe + so there is less to break. if this test fails it must be + the implementation of _through_ +*/ + +function write(array, stream) { + array = array.slice() + function next() { + while(array.length) + if(stream.write(array.shift()) === false) + return stream.once('drain', next) + + stream.end() + } + + next() +} + +function read(stream, callback) { + var actual = [] + stream.on('data', function (data) { + actual.push(data) + }) + stream.once('end', function () { + callback(null, actual) + }) + stream.once('error', function (err) { + callback(err) + }) +} + +test('simple defaults', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through() + var s = spec(t).through().pausable() + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}); + +test('simple functions', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l * Math.random()) + + var t = through(function (data) { + this.emit('data', data*2) + }) + var s = spec(t).through().pausable() + + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected.map(function (data) { + return data*2 + })) + assert.end() + }) + + t.on('close', s.validate) + + write(expected, t) +}) + +test('pauses', function(assert) { + + var l = 1000 + , expected = [] + + while(l--) expected.push(l) //Math.random()) + + var t = through() + + var s = spec(t) + .through() + .pausable() + + t.on('data', function () { + if(Math.random() > 0.1) return + t.pause() + process.nextTick(function () { + t.resume() + }) + }) + + read(t, function (err, actual) { + assert.ifError(err) + assert.deepEqual(actual, expected) + }) + + t.on('close', function () { + s.validate() + assert.end() + }) + + write(expected, t) +}) + +test('does not soft-end on `undefined`', function(assert) { + var stream = through() + , count = 0 + + stream.on('data', function (data) { + count++ + }) + + stream.write(undefined) + stream.write(undefined) + + assert.equal(count, 2) + + assert.end() +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/package.json ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/package.json b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/package.json new file mode 100644 index 0000000..998806b --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/package.json @@ -0,0 +1,88 @@ +{ + "name": "tape", + "version": "3.5.0", + "description": "tap-producing test harness for node and browsers", + "main": "index.js", + "bin": { + "tape": "./bin/tape" + }, + "directories": { + "example": "example", + "test": "test" + }, + "dependencies": { + "deep-equal": "~0.2.0", + "defined": "~0.0.0", + "glob": "~3.2.9", + "inherits": "~2.0.1", + "object-inspect": "~0.4.0", + "resumer": "~0.0.0", + "through": "~2.3.4" + }, + "devDependencies": { + "tap": "~0.4.8", + "falafel": "~0.3.1", + "concat-stream": "~1.4.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling": { + "files": "test/browser/*.js", + "browsers": [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", + "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/tape.git" + }, + "homepage": "https://github.com/substack/tape", + "keywords": [ + "tap", + "test", + "harness", + "assert", + "browser" + ], + "author": { + "name": "James Halliday", + "email": "[email protected]", + "url": "http://substack.net" + }, + "license": "MIT", + "gitHead": "51f2f97d7eade23b1e23b7cfea37f449ade5b9c3", + "bugs": { + "url": "https://github.com/substack/tape/issues" + }, + "_id": "[email protected]", + "_shasum": "aebb061388104ad0cb407be842782049d64624f8", + "_from": "tape@^3.5.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "raynos", + "email": "[email protected]" + }, + "maintainers": [ + { + "name": "substack", + "email": "[email protected]" + }, + { + "name": "raynos", + "email": "[email protected]" + } + ], + "dist": { + "shasum": "aebb061388104ad0cb407be842782049d64624f8", + "tarball": "http://registry.npmjs.org/tape/-/tape-3.5.0.tgz" + }, + "_resolved": "https://registry.npmjs.org/tape/-/tape-3.5.0.tgz", + "readme": "ERROR: No README data found!" +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/readme.markdown ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/readme.markdown b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/readme.markdown new file mode 100644 index 0000000..7a3263f --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/readme.markdown @@ -0,0 +1,317 @@ +# tape + +tap-producing test harness for node and browsers + +[](http://ci.testling.com/substack/tape) + +[](http://travis-ci.org/substack/tape) + + + +# example + +``` js +var test = require('tape'); + +test('timing test', function (t) { + t.plan(2); + + t.equal(typeof Date.now, 'function'); + var start = Date.now(); + + setTimeout(function () { + t.equal(Date.now() - start, 100); + }, 100); +}); +``` + +``` +$ node example/timing.js +TAP version 13 +# timing test +ok 1 should be equal +not ok 2 should be equal + --- + operator: equal + expected: 100 + actual: 107 + ... + +1..2 +# tests 2 +# pass 1 +# fail 1 +``` + +# pretty reporters + +The default TAP output is good for machines and humans that are robots. + +If you want a more colorful / pretty output there are lots of modules on npm +that will output something pretty if you pipe TAP into them: + + - https://github.com/scottcorgan/tap-spec + - https://github.com/scottcorgan/tap-dot + - https://github.com/substack/faucet + - https://github.com/juliangruber/tap-bail + - https://github.com/kirbysayshi/tap-browser-color + - https://github.com/gummesson/tap-json + - https://github.com/gummesson/tap-min + - https://github.com/calvinmetcalf/tap-nyan + - https://www.npmjs.org/package/tap-pessimist + - https://github.com/toolness/tap-prettify + - https://github.com/shuhei/colortape + - https://github.com/aghassemi/tap-xunit + +To use them, try `node test/index.js | tap-spec` or pipe it into one +of the modules of your choice! + +# uncaught exceptions + +By default, uncaught exceptions in your tests will not be intercepted, and will cause tape to crash. If you find this behavior undesirable, use [tape-catch](https://github.com/michaelrhodes/tape-catch) to report any exceptions as TAP errors. + +# methods + +The assertion methods in tape are heavily influenced or copied from the methods +in [node-tap](https://github.com/isaacs/node-tap). + +``` +var test = require('tape') +``` + +## test([name], [opts], cb) + +Create a new test with an optional `name` string and optional `opts` object. +`cb(t)` fires with the new test object `t` once all preceeding tests have +finished. Tests execute serially. + +Available `opts` options are: +- opts.skip = true/false. See test.skip. +- opts.timeout = 500. Set a timeout for the test, after which it will fail. + See test.timeoutAfter. + +If you forget to `t.plan()` out how many assertions you are going to run and you +don't call `t.end()` explicitly, your test will hang. + +## test.skip(name, cb) + +Generate a new test that will be skipped over. + +## t.plan(n) + +Declare that `n` assertions should be run. `t.end()` will be called +automatically after the `n`th assertion. If there are any more assertions after +the `n`th, or after `t.end()` is called, they will generate errors. + +## t.end(err) + +Declare the end of a test explicitly. If `err` is passed in `t.end` will assert +that it is falsey. + +## t.fail(msg) + +Generate a failing assertion with a message `msg`. + +## t.pass(msg) + +Generate a passing assertion with a message `msg`. + +## t.timeoutAfter(ms) + +Automatically timeout the test after X ms. + +## t.skip(msg) + +Generate an assertion that will be skipped over. + +## t.ok(value, msg) + +Assert that `value` is truthy with an optional description message `msg`. + +Aliases: `t.true()`, `t.assert()` + +## t.notOk(value, msg) + +Assert that `value` is falsy with an optional description message `msg`. + +Aliases: `t.false()`, `t.notok()` + +## t.error(err, msg) + +Assert that `err` is falsy. If `err` is non-falsy, use its `err.message` as the +description message. + +Aliases: `t.ifError()`, `t.ifErr()`, `t.iferror()` + +## t.equal(actual, expected, msg) + +Assert that `actual === expected` with an optional description `msg`. + +Aliases: `t.equals()`, `t.isEqual()`, `t.is()`, `t.strictEqual()`, +`t.strictEquals()` + +## t.notEqual(actual, expected, msg) + +Assert that `actual !== expected` with an optional description `msg`. + +Aliases: `t.notEquals()`, `t.notStrictEqual()`, `t.notStrictEquals()`, +`t.isNotEqual()`, `t.isNot()`, `t.not()`, `t.doesNotEqual()`, `t.isInequal()` + +## t.deepEqual(actual, expected, msg) + +Assert that `actual` and `bexpected` have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with strict comparisons (`===`) on leaf nodes and an optional description +`msg`. + +Aliases: `t.deepEquals()`, `t.isEquivalent()`, `t.same()` + +## t.notDeepEqual(actual, expected, msg) + +Assert that `actual` and `expected` do not have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with strict comparisons (`===`) on leaf nodes and an optional description +`msg`. + +Aliases: `t.notEquivalent()`, `t.notDeeply()`, `t.notSame()`, +`t.isNotDeepEqual()`, `t.isNotDeeply()`, `t.isNotEquivalent()`, +`t.isInequivalent()` + +## t.deepLooseEqual(actual, expected, msg) + +Assert that `actual` and `expected` have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with loose comparisons (`==`) on leaf nodes and an optional description `msg`. + +Aliases: `t.looseEqual()`, `t.looseEquals()` + +## t.notDeepLooseEqual(actual, expected, msg) + +Assert that `actual` and `expected` do not have the same structure and nested values using +[node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) +with loose comparisons (`==`) on leaf nodes and an optional description `msg`. + +Aliases: `t.notLooseEqual()`, `t.notLooseEquals()` + +## t.throws(fn, expected, msg) + +Assert that the function call `fn()` throws an exception. `expected`, if present, must be a `RegExp` or `Function`. + +## t.doesNotThrow(fn, expected, msg) + +Assert that the function call `fn()` does not throw an exception. + +## t.test(name, cb) + +Create a subtest with a new test handle `st` from `cb(st)` inside the current +test `t`. `cb(st)` will only fire when `t` finishes. Additional tests queued up +after `t` will not be run until all subtests finish. + +## var htest = test.createHarness() + +Create a new test harness instance, which is a function like `test()`, but with +a new pending stack and test state. + +By default the TAP output goes to `console.log()`. You can pipe the output to +someplace else if you `htest.createStream().pipe()` to a destination stream on +the first tick. + +## test.only(name, cb) + +Like `test(name, cb)` except if you use `.only` this is the only test case +that will run for the entire process, all other test cases using tape will +be ignored + +## var stream = test.createStream(opts) + +Create a stream of output, bypassing the default output stream that writes +messages to `console.log()`. By default `stream` will be a text stream of TAP +output, but you can get an object stream instead by setting `opts.objectMode` to +`true`. + +### tap stream reporter + +You can create your own custom test reporter using this `createStream()` api: + +``` js +var test = require('tape'); +var path = require('path'); + +test.createStream().pipe(process.stdout); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); +``` + +You could substitute `process.stdout` for whatever other output stream you want, +like a network connection or a file. + +Pass in test files to run as arguments: + +``` +$ node tap.js test/x.js test/y.js +TAP version 13 +# (anonymous) +not ok 1 should be equal + --- + operator: equal + expected: "boop" + actual: "beep" + ... +# (anonymous) +ok 2 should be equal +ok 3 (unnamed assert) +# wheee +ok 4 (unnamed assert) + +1..4 +# tests 4 +# pass 3 +# fail 1 +``` + +### object stream reporter + +Here's how you can render an object stream instead of TAP: + +``` js +var test = require('tape'); +var path = require('path'); + +test.createStream({ objectMode: true }).on('data', function (row) { + console.log(JSON.stringify(row)) +}); + +process.argv.slice(2).forEach(function (file) { + require(path.resolve(file)); +}); +``` + +The output for this runner is: + +``` +$ node object.js test/x.js test/y.js +{"type":"test","name":"(anonymous)","id":0} +{"id":0,"ok":false,"name":"should be equal","operator":"equal","actual":"beep","expected":"boop","error":{},"test":0,"type":"assert"} +{"type":"end","test":0} +{"type":"test","name":"(anonymous)","id":1} +{"id":0,"ok":true,"name":"should be equal","operator":"equal","actual":2,"expected":2,"test":1,"type":"assert"} +{"id":1,"ok":true,"name":"(unnamed assert)","operator":"ok","actual":true,"expected":true,"test":1,"type":"assert"} +{"type":"end","test":1} +{"type":"test","name":"wheee","id":2} +{"id":0,"ok":true,"name":"(unnamed assert)","operator":"ok","actual":true,"expected":true,"test":2,"type":"assert"} +{"type":"end","test":2} +``` + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install tape +``` + +# license + +MIT http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/add-subtest-async.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/add-subtest-async.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/add-subtest-async.js new file mode 100644 index 0000000..74b4d8a --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/add-subtest-async.js @@ -0,0 +1,11 @@ +var test = require('../') + +test('parent', function (t) { + t.pass('parent'); + setTimeout(function () { + t.test('child', function (t) { + t.pass('child'); + t.end(); + }); + }, 100) +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/array.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/array.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/array.js new file mode 100644 index 0000000..2d49863 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/array.js @@ -0,0 +1,68 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'tests 5', + 'pass 5', + 'ok' + ]); + }); + + test.createStream().pipe(tc); + + test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/bound.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/bound.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/bound.js new file mode 100644 index 0000000..d398195 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/bound.js @@ -0,0 +1,10 @@ +var test = require('../'); + +test('bind works', function (t) { + t.plan(2); + var equal = t.equal; + var deepEqual = t.deepEqual; + equal(3, 3); + deepEqual([4], [4]); + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/browser/asserts.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/browser/asserts.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/browser/asserts.js new file mode 100644 index 0000000..a1b24f6 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/browser/asserts.js @@ -0,0 +1,9 @@ +var test = require('../../'); + +test(function (t) { + t.plan(4); + t.ok(true); + t.equal(3, 1+2); + t.deepEqual([1,2,[3,4]], [1,2,[3,4]]); + t.notDeepEqual([1,2,[3,4,5]], [1,2,[3,4]]); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/child_ordering.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/child_ordering.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/child_ordering.js new file mode 100644 index 0000000..12efafe --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/child_ordering.js @@ -0,0 +1,54 @@ +var test = require('../'); + +var childRan = false; + +test('parent', function(t) { + t.test('child', function(t) { + childRan = true; + t.pass('child ran'); + t.end(); + }); + t.end(); +}); + +test('uncle', function(t) { + t.ok(childRan, 'Child should run before next top-level test'); + t.end(); +}); + +var grandParentRan = false; +var parentRan = false; +var grandChildRan = false; +test('grandparent', function(t) { + t.ok(!grandParentRan, 'grand parent ran twice'); + grandParentRan = true; + t.test('parent', function(t) { + t.ok(!parentRan, 'parent ran twice'); + parentRan = true; + t.test('grandchild', function(t) { + t.ok(!grandChildRan, 'grand child ran twice'); + grandChildRan = true; + t.pass('grand child ran'); + t.end(); + }); + t.pass('parent ran'); + t.end(); + }); + t.test('other parent', function(t) { + t.ok(parentRan, 'first parent runs before second parent'); + t.ok(grandChildRan, 'grandchild runs before second parent'); + t.end(); + }); + t.pass('grandparent ran'); + t.end(); +}); + +test('second grandparent', function(t) { + t.ok(grandParentRan, 'grandparent ran'); + t.ok(parentRan, 'parent ran'); + t.ok(grandChildRan, 'grandchild ran'); + t.pass('other grandparent ran'); + t.end(); +}); + +// vim: set softtabstop=4 shiftwidth=4: http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/circular-things.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/circular-things.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/circular-things.js new file mode 100644 index 0000000..1a0368d --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/circular-things.js @@ -0,0 +1,43 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('circular test', function (assert) { + var test = tape.createHarness({ exit : false }); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + // console.log("rs", rows) + + // console.log("deepEqual?") + + assert.same(rows, [ + "TAP version 13" + , "circular" + , { id: 1 + , ok: false + , name: " should be equal" + , operator: "equal" + , expected: "{}" + , actual: '{ circular: [Circular] }' + } + , "tests 1" + , "pass 0" + , "fail 1" + ]) + assert.end() + }) + + // tt.equal(10, 10) + // tt.end() + + test.createStream().pipe(tc); + + test("circular", function (t) { + t.plan(1) + var circular = {} + circular.circular = circular + t.equal(circular, {}) + }) +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/deep.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/deep.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/deep.js new file mode 100644 index 0000000..02f3681 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/deep.js @@ -0,0 +1,9 @@ +var test = require('../'); + +test('deep strict equal', function (t) { + t.notDeepEqual( + [ { a: '3' } ], + [ { a: 3 } ] + ); + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end.js new file mode 100644 index 0000000..c405d45 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end.js @@ -0,0 +1,27 @@ +var test = require('tap').test; +var concat = require('concat-stream'); +var spawn = require('child_process').spawn; + +test(function (t) { + t.plan(2); + var ps = spawn(process.execPath, [ __dirname + '/double_end/double.js' ]); + ps.on('exit', function (code) { + t.equal(code, 1); + }); + ps.stdout.pipe(concat(function (body) { + t.equal(body.toString('utf8'), [ + 'TAP version 13', + '# double end', + 'ok 1 should be equal', + 'not ok 2 .end() called twice', + ' ---', + ' operator: fail', + ' ...', + '', + '1..2', + '# tests 2', + '# pass 1', + '# fail 1', + ].join('\n') + '\n\n'); + })); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end/double.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end/double.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end/double.js new file mode 100644 index 0000000..4473482 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/double_end/double.js @@ -0,0 +1,9 @@ +var test = require('../../'); + +test('double end', function (t) { + t.equal(1 + 1, 2); + t.end(); + setTimeout(function () { + t.end(); + }, 5); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/end-as-callback.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/end-as-callback.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/end-as-callback.js new file mode 100644 index 0000000..6d24a0c --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/end-as-callback.js @@ -0,0 +1,66 @@ +var tap = require("tap"); +var tape = require("../"); + +tap.test("tape assert.end as callback", function (tt) { + var test = tape.createHarness({ exit: false }) + var tc = tap.createConsumer() + + var rows = [] + tc.on("data", function (r) { rows.push(r) }) + tc.on("end", function () { + var rs = rows.map(function (r) { + return r && typeof r === "object" ? + { id: r.id, ok: r.ok, name: r.name.trim() } : + r + }) + + tt.deepEqual(rs, [ + "TAP version 13", + "do a task and write", + { id: 1, ok: true, name: "null" }, + { id: 2, ok: true, name: "should be equal" }, + { id: 3, ok: true, name: "null" }, + "do a task and write fail", + { id: 4, ok: true, name: "null" }, + { id: 5, ok: true, name: "should be equal" }, + { id: 6, ok: false, name: "Error: fail" }, + "tests 6", + "pass 5", + "fail 1" + ]) + + tt.end() + }) + + test.createStream().pipe(tc) + + test("do a task and write", function (assert) { + fakeAsyncTask("foo", function (err, value) { + assert.ifError(err) + assert.equal(value, "taskfoo") + + fakeAsyncWrite("bar", assert.end) + }) + }) + + test("do a task and write fail", function (assert) { + fakeAsyncTask("bar", function (err, value) { + assert.ifError(err) + assert.equal(value, "taskbar") + + fakeAsyncWriteFail("baz", assert.end) + }) + }) +}) + +function fakeAsyncTask(name, cb) { + cb(null, "task" + name) +} + +function fakeAsyncWrite(name, cb) { + cb(null) +} + +function fakeAsyncWriteFail(name, cb) { + cb(new Error("fail")) +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit.js new file mode 100644 index 0000000..7f7c5d0 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit.js @@ -0,0 +1,142 @@ +var tap = require('tap'); +var spawn = require('child_process').spawn; + +tap.test('exit ok', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'tests 5', + 'pass 5', + 'ok' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/ok.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.equal(code, 0); + }); +}); + +tap.test('exit fail', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: false, name: 'should be equivalent' }, + 'tests 5', + 'pass 4', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/fail.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); + +tap.test('too few exit', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + { id: 6, ok: false, name: 'plan != count' }, + 'tests 6', + 'pass 5', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/too_few.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); + +tap.test('more planned in a second test', function (t) { + t.plan(2); + + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + t.same(rs, [ + 'TAP version 13', + 'first', + { id: 1, ok: true, name: '(unnamed assert)' }, + 'second', + { id: 2, ok: true, name: '(unnamed assert)' }, + { id: 3, ok: false, name: 'plan != count' }, + 'tests 3', + 'pass 2', + 'fail 1' + ]); + }); + + var ps = spawn(process.execPath, [ __dirname + '/exit/second.js' ]); + ps.stdout.pipe(tc); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/fail.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/fail.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/fail.js new file mode 100644 index 0000000..d7fd3ce --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/fail.js @@ -0,0 +1,35 @@ +var test = require('../../'); +var falafel = require('falafel'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/ok.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/ok.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/ok.js new file mode 100644 index 0000000..a02c7b6 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/ok.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../../'); + +test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/second.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/second.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/second.js new file mode 100644 index 0000000..8a206bb --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/second.js @@ -0,0 +1,11 @@ +var test = require('../../'); + +test('first', function (t) { + t.plan(1); + t.ok(true); +}); + +test('second', function (t) { + t.plan(2); + t.ok(true); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/too_few.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/too_few.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/too_few.js new file mode 100644 index 0000000..8e60ce5 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/exit/too_few.js @@ -0,0 +1,35 @@ +var falafel = require('falafel'); +var test = require('../../'); + +test('array', function (t) { + t.plan(6); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/fail.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/fail.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/fail.js new file mode 100644 index 0000000..d56045a --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/fail.js @@ -0,0 +1,68 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness({ exit : false }); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'array', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: false, name: 'should be equivalent' }, + 'tests 5', + 'pass 4', + 'fail 1' + ]); + }); + + test.createStream().pipe(tc); + + test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/many.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/many.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/many.js new file mode 100644 index 0000000..10556e5 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/many.js @@ -0,0 +1,8 @@ +var test = require('../'); + +test('many tests', function (t) { + t.plan(100); + for (var i = 0; i < 100; i++) { + setTimeout(function () { t.pass() }, Math.random() * 50); + } +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners.js new file mode 100644 index 0000000..5edfb15 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners.js @@ -0,0 +1,7 @@ +var spawn = require('child_process').spawn; +var ps = spawn(process.execPath, [ __dirname + '/max_listeners/source.js' ]); +ps.stdout.pipe(process.stdout, { end : false }); + +ps.stderr.on('data', function (buf) { + console.log('not ok ' + buf); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners/source.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners/source.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners/source.js new file mode 100644 index 0000000..839a327 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/max_listeners/source.js @@ -0,0 +1,5 @@ +var test = require('../../'); + +for (var i = 0; i < 11; i ++) { + test(function (t) { t.end() }); +} http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-async-plan-noend.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-async-plan-noend.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-async-plan-noend.js new file mode 100644 index 0000000..6f8cfdd --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-async-plan-noend.js @@ -0,0 +1,36 @@ +var test = require('../'); + +test('Harness async test support', function(t) { + t.plan(3); + + t.ok(true, 'sync child A'); + + t.test('sync child B', function(tt) { + tt.plan(2); + + setTimeout(function(){ + tt.test('async grandchild A', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 50); + + setTimeout(function() { + tt.test('async grandchild B', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 100); + }); + + setTimeout(function() { + t.test('async child', function(tt) { + tt.plan(2); + tt.ok(true, 'sync grandchild in async child A'); + tt.test('sync grandchild in async child B', function(ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }); + }, 200); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-sync-noplan-noend.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-sync-noplan-noend.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-sync-noplan-noend.js new file mode 100644 index 0000000..a206c50 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested-sync-noplan-noend.js @@ -0,0 +1,50 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('nested sync test without plan or end', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + var expected = [ + 'TAP version 13', + 'nested without plan or end', + 'first', + { id: 1, ok: true, name: '(unnamed assert)' }, + 'second', + { id: 2, ok: true, name: '(unnamed assert)' }, + 'tests 2', + 'pass 2', + 'ok' + ] + tt.same(rs, expected); + }); + + test.createStream().pipe(tc); + + test('nested without plan or end', function(t) { + t.test('first', function(q) { + setTimeout(function first() { + q.ok(true); + q.end() + }, 10); + }); + t.test('second', function(q) { + setTimeout(function second() { + q.ok(true); + q.end() + }, 10); + }); + }); + +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested.js new file mode 100644 index 0000000..673465d --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested.js @@ -0,0 +1,89 @@ +var falafel = require('falafel'); +var tape = require('../'); +var tap = require('tap'); + +tap.test('array test', function (tt) { + tt.plan(1); + + var test = tape.createHarness(); + var tc = tap.createConsumer(); + + var rows = []; + tc.on('data', function (r) { rows.push(r) }); + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id : r.id, ok : r.ok, name : r.name.trim() }; + } + else return r; + }); + tt.same(rs, [ + 'TAP version 13', + 'nested array test', + { id: 1, ok: true, name: 'should be equivalent' }, + { id: 2, ok: true, name: 'should be equivalent' }, + { id: 3, ok: true, name: 'should be equivalent' }, + { id: 4, ok: true, name: 'should be equivalent' }, + { id: 5, ok: true, name: 'should be equivalent' }, + 'inside test', + { id: 6, ok: true, name: '(unnamed assert)' }, + { id: 7, ok: true, name: '(unnamed assert)' }, + 'another', + { id: 8, ok: true, name: '(unnamed assert)' }, + 'tests 8', + 'pass 8', + 'ok' + ]); + }); + + test.createStream().pipe(tc); + + test('nested array test', function (t) { + t.plan(6); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); + + setTimeout(function () { + q.ok(true); + }, 100); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], + ]; + + Function(['fn','g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); + }); + + test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 50); + }); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested2.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested2.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested2.js new file mode 100644 index 0000000..58ae8f3 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/nested2.js @@ -0,0 +1,19 @@ +var test = require('../'); + +test(function(t) { + var i = 0 + t.test('setup', function(t) { + process.nextTick(function() { + t.equal(i, 0, 'called once') + i++ + t.end() + }) + }) + + + t.test('teardown', function(t) { + t.end() + }) + + t.end() +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/no_callback.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/no_callback.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/no_callback.js new file mode 100644 index 0000000..760ff26 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/no_callback.js @@ -0,0 +1,3 @@ +var test = require('../'); + +test('No callback.'); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only.js new file mode 100644 index 0000000..9e6bc26 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only.js @@ -0,0 +1,53 @@ +var tap = require('tap'); +var tape = require('../'); + +tap.test('tape only test', function (tt) { + var test = tape.createHarness({ exit: false }); + var tc = tap.createConsumer(); + var ran = []; + + var rows = [] + tc.on('data', function (r) { rows.push(r) }) + tc.on('end', function () { + var rs = rows.map(function (r) { + if (r && typeof r === 'object') { + return { id: r.id, ok: r.ok, name: r.name.trim() }; + } + else { + return r; + } + }) + + tt.deepEqual(rs, [ + 'TAP version 13', + 'run success', + { id: 1, ok: true, name: 'assert name'}, + 'tests 1', + 'pass 1', + 'ok' + ]) + tt.deepEqual(ran, [ 3 ]); + + tt.end() + }) + + test.createStream().pipe(tc) + + test("never run fail", function (t) { + ran.push(1); + t.equal(true, false) + t.end() + }) + + test("never run success", function (t) { + ran.push(2); + t.equal(true, true) + t.end() + }) + + test.only("run success", function (t) { + ran.push(3); + t.ok(true, "assert name") + t.end() + }) +}) http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only2.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only2.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only2.js new file mode 100644 index 0000000..fcf4f43 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only2.js @@ -0,0 +1,9 @@ +var test = require('../'); + +test('only2 test 1', function (t) { + t.end(); +}); + +test.only('only2 test 2', function (t) { + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only3.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only3.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only3.js new file mode 100644 index 0000000..b192a4e --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/only3.js @@ -0,0 +1,15 @@ +var test = require('../'); + +test('only3 test 1', function (t) { + t.fail('not 1'); + t.end(); +}); + +test.only('only3 test 2', function (t) { + t.end(); +}); + +test('only3 test 3', function (t) { + t.fail('not 3'); + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/order.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/order.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/order.js new file mode 100644 index 0000000..02aaa05 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/order.js @@ -0,0 +1,17 @@ +var test = require('../'); +var current = 0; + +test(function (t) { + t.equal(current++, 0); + t.end(); +}); +test(function (t) { + t.plan(1); + setTimeout(function () { + t.equal(current++, 1); + }, 100); +}); +test(function (t) { + t.equal(current++, 2); + t.end(); +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/plan_optional.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/plan_optional.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/plan_optional.js new file mode 100644 index 0000000..a092eab --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/plan_optional.js @@ -0,0 +1,15 @@ +var test = require('../'); + +test('plan should be optional', function (t) { + t.pass('no plan here'); + t.end(); +}); + +test('no plan async', function (t) { + setTimeout(function() { + t.pass('ok'); + t.end(); + }, 100); +}); + +// vim: set softtabstop=4 shiftwidth=4: http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/skip.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/skip.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/skip.js new file mode 100644 index 0000000..216b600 --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/skip.js @@ -0,0 +1,46 @@ +var test = require('../'); +var ran = 0; + +test('do not skip this', { skip: false }, function(t) { + t.pass('this should run'); + ran ++; + t.end(); +}); + +test('skip this', { skip: true }, function(t) { + t.fail('this should not even run'); + ran++; + t.end(); +}); + +test.skip('skip this too', function(t) { + t.fail('this should not even run'); + ran++; + t.end(); +}); + +test.skip('skip this too', function(t) { + t.fail('this should not even run'); + t.end(); +}); + +test('skip subtest', function(t) { + ran ++; + t.test('do not skip this', { skip: false }, function(t) { + ran ++; + t.pass('this should run'); + t.end(); + }); + t.test('skip this', { skip: true }, function(t) { + t.fail('this should not even run'); + t.end(); + }); + t.end(); +}); + +test('right number of tests ran', function(t) { + t.equal(ran, 3, 'ran the right number of tests'); + t.end(); +}); + +// vim: set softtabstop=4 shiftwidth=4: http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4f8d066f/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/subcount.js ---------------------------------------------------------------------- diff --git a/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/subcount.js b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/subcount.js new file mode 100644 index 0000000..3a5df3f --- /dev/null +++ b/bin/node_modules/cordova-common/node_modules/cordova-registry-mapper/node_modules/tape/test/subcount.js @@ -0,0 +1,14 @@ +var test = require('../'); + +test('parent test', function (t) { + t.plan(2); + t.test('first child', function (t) { + t.plan(1); + t.pass('pass first child'); + }) + + t.test(function (t) { + t.plan(1); + t.pass('pass second child'); + }) +}) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
