fix up tests to work with the new method binding operator

This commit is contained in:
Sebastian McKenzie
2014-12-13 12:40:43 +11:00
parent 03dcc335d8
commit aae7d8190b
7 changed files with 22 additions and 20 deletions

View File

@@ -1 +1 @@
SyntaxError: test.js: Unexpected character '#'
SyntaxError: test.js: Unexpected token (2:10)

View File

@@ -1,3 +1,3 @@
arr.map(x => {
$#!
arr.map(function () {
return $]!;
});

View File

@@ -1,3 +1,3 @@
arr.map(function () {
return $#!;
return $]!;
});

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected character '#'"
"throws": "Unexpected token (2:10)"
}

View File

@@ -1,13 +1,13 @@
var fn = obj:method;
var fn = obj:method("foob");
var fn = obj[foo]:method;
var fn = obj.foo:method;
var fn = obj[foo()]:method;
var fn = obj#method;
var fn = obj#method("foob");
var fn = obj[foo]#method;
var fn = obj.foo#method;
var fn = obj[foo()]#method;
["foo", "bar"].map(:toUpperCase);
[1.1234, 23.53245, 3].map(:toFixed(2));
["foo", "bar"].map(#toUpperCase);
[1.1234, 23.53245, 3].map(#toFixed(2));
var get = function () {
return 2;
};
[1.1234, 23.53245, 3].map(:toFixed(get()));
[1.1234, 23.53245, 3].map(#toFixed(get()));

View File

@@ -12,19 +12,19 @@ var obj = {
}
};
var foo = obj:getFoo;
var foo = obj#getFoo;
assert.equal(foo(), "foo");
var bar = obj:getBar("foo");
var bar = obj#getBar("foo");
assert.equal(bar(), "foo bar");
var zoo = obj:getZoo("foo");
var zoo = obj#getZoo("foo");
assert.equal(zoo("bar"), "foo bar foo bar");
assert.deepEqual(["foo", "bar"].map(:toUpperCase), ["FOO", "BAR"]);
assert.deepEqual([1.1234, 23.53245, 3].map(:toFixed(2)), ["1.12", "23.53", "3.00"]);
assert.deepEqual(["foo", "bar"].map(#toUpperCase), ["FOO", "BAR"]);
assert.deepEqual([1.1234, 23.53245, 3].map(#toFixed(2)), ["1.12", "23.53", "3.00"]);
var get = function () {
return 2;
}
assert.deepEqual([1.1234, 23.53245, 3].map(:toFixed(get())), ["1.12", "23.53", "3.00"]);
assert.deepEqual([1.1234, 23.53245, 3].map(#toFixed(get())), ["1.12", "23.53", "3.00"]);

View File

@@ -77,7 +77,9 @@ _.each(helper.get("transformation"), function (testSuite) {
// the options object with useless options
delete task.options.throws;
assert.throws(runTask, new RegExp(throwMsg));
assert.throws(runTask, function (err) {
return err.message.indexOf(throwMsg) >= 0;
});
} else {
runTask();
}