Skip to content

Commit

Permalink
now all the browser tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
disnet committed Dec 15, 2011
1 parent 4f6cf54 commit 9fc5105
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 273 deletions.
4 changes: 1 addition & 3 deletions index.html
Expand Up @@ -5,11 +5,9 @@
<title>Contract.js Test Suite</title>
<link rel="Stylesheet" href="test/qunit.css"></script>

<script type="text/javascript" src="src/stacktrace.js"></script>
<script type="text/javascript" src="src/contracts.js"></script>
<script type="text/javascript" src="lib/contracts.js"></script>

<script type="text/javascript" src="test/jquery.js"></script>
<script type="text/javascript" src="test/jquery-c.js"></script>

<script type="text/javascript" src="test/qunit.js"></script>
<script type="text/javascript" src="test/test.js"></script>
Expand Down
24 changes: 3 additions & 21 deletions lib/contracts.js
Expand Up @@ -332,25 +332,7 @@ printStackTrace.implementation.prototype = {
}
};

(function() {(function() {
var old_require;
if (typeof require !== 'undefined' && require !== null) {
old_require = require;
require = function(mod, filename) {
var key, m = old_require(mod);
for(key in m) {
if(typeof(m[key]) && m[key].hasOwnProperty && m[key].hasOwnProperty('use')) {
m[key] = m[key].use(filename, mod);
}
}
return m;
};
for(var key in old_require) {
require[key] = old_require[key];
}
}
})();

(function() {

"use strict";

Expand Down Expand Up @@ -1354,7 +1336,7 @@ printStackTrace.implementation.prototype = {
return enabled = b;
};

root.autoload = function(obj) {
root.autoload = function() {
var globalObj, name;
globalObj = typeof window !== "undefined" && window !== null ? window : global;
for (name in root) {
Expand All @@ -1363,4 +1345,4 @@ printStackTrace.implementation.prototype = {
}
};

}).call(this);
}).call(this);
6 changes: 3 additions & 3 deletions src/contracts.coffee
Expand Up @@ -335,9 +335,9 @@ fun = (dom, rng, options) ->
res = new bf()
res = clean_rng.check(res, pos, neg, parents, stack)
else
if options["this"]
if options.this
# blame is reversed
thisc = options["this"].check(this, neg, pos, parents, stack)
thisc = options.this.check(this, neg, pos, parents, stack)
else
thisc = this
res = clean_rng.check(f.apply(thisc, args), pos, neg, parents, stack)
Expand Down Expand Up @@ -851,7 +851,7 @@ root.opt = opt
root.guard = guard
root.enabled = (b) -> enabled = b
# puts every exported function onto the global scope
root.autoload = (obj) ->
root.autoload = ->
globalObj = window ? global # browser or node
globalObj[name] = root[name] for own name of root
return
Expand Down
233 changes: 0 additions & 233 deletions test/jquery-c.js

This file was deleted.

15 changes: 2 additions & 13 deletions test/test.js
@@ -1,16 +1,5 @@
var C = Contracts.combinators,
K = Contracts.contracts;

function load(obj) {
var name;
for(name in obj) {
if(obj.hasOwnProperty(name)) {
window[name] = obj[name];
}
}
}
load(Contracts.combinators);
load(Contracts.contracts);
Contracts.autoload();

var server = "server";
var client = "client";

Expand Down

0 comments on commit 9fc5105

Please sign in to comment.