Skip to content

Commit

Permalink
Fixes #9 with test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethkufluk committed Jun 16, 2011
1 parent 3c0d802 commit ebcf877
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/loadrunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
// pushObjPath(thing, 'a/b/c', new) //=> thing.a.b.c = new
var names = path.split('/'), cursor = obj;
while (names.length > 1) {
cursor = cursor[names.shift()] = {};
var name = names.shift();
cursor = cursor[name] = cursor[name] || {};
}
cursor[names[0]] = newobj;
}
Expand Down
5 changes: 5 additions & 0 deletions test/modules/sub/submoda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provide(function(exports) {
using('moda', function(moda) {
exports(moda);
});
});
5 changes: 5 additions & 0 deletions test/modules/sub/submodb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provide(function(exports) {
using('modb', function(modb) {
exports(modb);
});
});
11 changes: 11 additions & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ <h2 id="qunit-userAgent"></h2>
});
});

QUnit.test('should collect module results without overwriting namespaces', function() {
expect(2);
stop(1000);

using('sub/submoda', 'sub/submodb', true, function(results) {
equals('success', results.sub.submodb.test(), 'sub.submodb exports loaded');
equals('success', results.sub.submoda.test, 'sub.submoda exports loaded');
start();
});
});

QUnit.module('loadrunner.Script.loaded');

QUnit.test('should list files loaded in order', function() {
Expand Down

0 comments on commit ebcf877

Please sign in to comment.