Skip to content

Commit

Permalink
issue #254 - progress on browser-side generators unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bjouhier committed Mar 7, 2015
1 parent 92e516c commit e9c1849
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
41 changes: 19 additions & 22 deletions lib/generators/runtime.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
if (typeof exports !== 'undefined') {
exports = module.exports = Object.create(require('galaxy'));
} else {
exports = (Streamline.runtime = Streamline.runtime || Object.create(require('galaxy')));
}
var globals = exports.globals = require('../globals');
exports.globals.runtime = 'generators';
require("../generators/builtins");
var fut = require("../util/future");
exports.streamlinify = fut.streamlinify;
(function(exports) {
var globals = exports.globals = require('../globals');
exports.globals.runtime = 'generators';
require("../generators/builtins");
var fut = require("../util/future");
exports.streamlinify = fut.streamlinify;

var unstar = exports.unstar;
var unstar = exports.unstar;

exports.unstar = function(fn, options, entering) {
if (typeof options === "number") options = {
callbackIndex: options,
};
else options = options || {};
options.promise = options.callbackDefault ? function(fn, args, i) {
return fut.future.call(this, fn, args, i)(options.callbackDefault());
} : fut.promise;
return unstar(fn, options, entering);
}
exports.unstar = function(fn, options, entering) {
if (typeof options === "number") options = {
callbackIndex: options,
};
else options = options || {};
options.promise = options.callbackDefault ? function(fn, args, i) {
return fut.future.call(this, fn, args, i)(options.callbackDefault());
} : fut.promise;
return unstar(fn, options, entering);
}

exports.then = exports.star(fut.then, 2);
exports.then = exports.star(fut.then, 2);
})(typeof exports !== 'undefined' ? module.exports = Object.create(require('galaxy')) : Streamline.runtime = Streamline.runtime || Object.create(require('galaxy')));
7 changes: 4 additions & 3 deletions test/common/generators/eval-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script src="../../../lib/generators/require-stub.js" type="application/javascript"></script>
<script src="../../../lib/util/future.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript;version=1.7"></script>
<script src="eval-test.js" type="application/javascript;version=1.7"></script>
<script src="../../../node_modules/galaxy/lib/galaxy.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript"></script>
<script src="eval-test.js" type="application/javascript"></script>
</head>
<body>
<h1 id="qunit-header">streamline evaluation tests (generators)</h1>
Expand Down
7 changes: 4 additions & 3 deletions test/common/generators/flows-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script src="../../../lib/generators/require-stub.js" type="application/javascript"></script>
<script src="../../../lib/util/future.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript;version=1.7"></script>
<script src="../../../node_modules/galaxy/lib/galaxy.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript"></script>
<script src="../../../lib/generators/flows.js" type="application/javascript"></script>
<script src="flows-test.js" type="application/javascript;version=1.7"></script>
<script src="flows-test.js" type="application/javascript"></script>
</head>
<body>
<h1 id="qunit-header">streamline flows tests (generators)</h1>
Expand Down
8 changes: 4 additions & 4 deletions test/common/generators/futures-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script src="../../../lib/generators/require-stub.js" type="application/javascript"></script>
<script src="../../../lib/util/future.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/flows.js" type="application/javascript"></script>
<script src="futures-test.js" type="application/javascript;version=1.7"></script>
<script src="../../../node_modules/galaxy/lib/galaxy.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript"></script>
<script src="futures-test.js" type="application/javascript"></script>
</head>
<body>
<h1 id="qunit-header">streamline futures tests (generators)</h1>
Expand Down
8 changes: 4 additions & 4 deletions test/common/generators/stack-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<script type="text/javascript" src="../../qunit/qunit.js"></script>
<script src="../../../lib/generators/require-stub.js" type="application/javascript"></script>
<script src="../../../lib/util/future.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript;version=1.7"></script>
<script src="../../../lib/generators/flows.js" type="application/javascript"></script>
<script src="stack-test.js" type="application/javascript;version=1.7"></script>
<script src="../../../node_modules/galaxy/lib/galaxy.js" type="application/javascript"></script>
<script src="../../../lib/generators/runtime.js" type="application/javascript"></script>
<script src="../../../lib/generators/builtins.js" type="application/javascript"></script>
<script src="stack-test.js" type="application/javascript"></script>
</head>
<body>
<h1 id="qunit-header">streamline stack tests (generators - hacked for incomplete stacks)</h1>
Expand Down

0 comments on commit e9c1849

Please sign in to comment.