Skip to content

Instantly share code, notes, and snippets.

@luisgabriel
Created February 18, 2013 12:22
Show Gist options
  • Save luisgabriel/4976983 to your computer and use it in GitHub Desktop.
Save luisgabriel/4976983 to your computer and use it in GitHub Desktop.
buster.js bug
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);
},
});
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];
}
};
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