Started new specs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 2603bb4 · Browse files · 4 files·+117 added−0 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+117 added−0 removed
- tests:+29 added−0 removed
- other:+88 added−0 removed
Provenance
- Commit
965af7b- Tree
931da5b- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
2603bb4
4 files changed+117 added−0 removed
added:lib/express/core.js+2 added
12
Express = { version: '0.0.1' }No newline at end of fileadded:lib/support/oo.js+83 added
1+2+// OO - Class - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)3+// Based on http://ejohn.org/blog/simple-javascript-inheritance/4+// which is based on implementations by Prototype / base25+6+;(function(){7+ var global = this, initialize = true8+ var referencesSuper = /xyz/.test(function(){ xyz }) ? /\b__super__\b/ : /.*/9+10+ /**11+ * Shortcut for Class.extend()12+ *13+ * @param {hash} props14+ * @return {function}15+ * @api public16+ */17+18+ Class = function(props){19+ if (this == global)20+ return Class.extend(props) 21+ }22+ 23+ // --- Version24+ 25+ Class.version = '1.0.0'26+ 27+ /**28+ * Create a new class.29+ *30+ * User = Class({31+ * init: function(name){32+ * this.name = name33+ * }34+ * })35+ *36+ * Classes may be subclassed using the .extend() method, and37+ * the associated superclass method via this.__super__().38+ *39+ * Admin = User.extend({40+ * init: function(name, password) {41+ * this.__super__(name)42+ * // or this.__super__.apply(this, arguments)43+ * this.password = password44+ * }45+ * })46+ *47+ * @param {hash} props48+ * @return {function}49+ * @api public50+ */51+ 52+ Class.extend = function(props) {53+ var __super__ = this.prototype54+ 55+ initialize = false56+ var prototype = new this57+ initialize = true58+59+ for (var name in props)60+ prototype[name] = 61+ typeof props[name] == 'function' &&62+ typeof __super__[name] == 'function' &&63+ referencesSuper.test(props[name]) ?64+ (function(name, fn){65+ return function() {66+ this.__super__ = __super__[name]67+ return fn.apply(this, arguments)68+ }69+ })(name, props[name])70+ : props[name]71+ 72+ function Class() {73+ if (initialize && this.init)74+ this.init.apply(this, arguments)75+ }76+ 77+ Class.prototype = prototype78+ Class.constructor = Class79+ Class.extend = arguments.callee80+ 81+ return Class82+ }83+})()modified:lib/express.js+3 added
123
require('support/oo')require('express/core')No newline at end of fileadded:spec/spec.node.js+29 added
1234567891011121314151617181920212223242526272829require.paths.unshift("./spec/lib", "./lib");process.mixin(GLOBAL, require("sys"))
require("jspec")require("express")
var posix = require('posix')
quit = process.exitprint = puts
readFile = function(path) { var promise = posix.cat(path, "utf8") var result = '' promise.addErrback(function(){ throw "failed to read file `" + path + "'" }) promise.addCallback(function(contents){ result = contents }) promise.wait() return result}
if (process.ARGV[2]) JSpec.exec('spec/spec.' + process.ARGV[2] + '.js') else JSpec .exec('spec/spec.core.js')JSpec.run({ formatter: JSpec.formatters.Terminal, failuresOnly: true })JSpec.report()