Created
February 18, 2013 12:22
-
-
Save luisgabriel/4976983 to your computer and use it in GitHub Desktop.
buster.js bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var buster = require("buster"); | |
function include(path) { | |
var fs = require("fs"); | |
var vm = require("vm"); | |
var code = fs.readFileSync(path, "utf-8"); | |
vm.runInThisContext(code, path); | |
} | |
include("js/utils/object.js"); | |
buster.testCase("foo", { | |
"bar": function () { | |
assert.equals(100, 100); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.mixin = function (source) { | |
if (arguments.length !== 1) | |
return; | |
// check for inheritance metadata in the this class | |
if (!this.meta) { | |
this.meta = { | |
inheritsFrom: [] | |
}; | |
} | |
// add the this class in the inheritance metadata of the this class | |
this.meta.inheritsFrom.push(source); | |
for (var property in source.prototype) { | |
if (this.prototype.hasOwnProperty(property)) | |
continue; | |
// copy missing property from the parent class to the this class | |
this.prototype[property] = source.prototype[property]; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Skipping foo, unsupported requirement: mixin | |
Skipping GameWorld, unsupported requirement: mixin | |
Skipping Player, unsupported requirement: mixin | |
Skipping Rectangle, unsupported requirement: mixin | |
Skipping Stage, unsupported requirement: mixin | |
Passed: mixin mixin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment