add arrayify and regexify tests, add destructuring assignment expression statement only test
This commit is contained in:
1
test/fixtures/transformation/destructuring/assignment-expression-statement-only/actual.js
vendored
Normal file
1
test/fixtures/transformation/destructuring/assignment-expression-statement-only/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log([x] = [1]);
|
||||
3
test/fixtures/transformation/destructuring/assignment-expression-statement-only/options.json
vendored
Normal file
3
test/fixtures/transformation/destructuring/assignment-expression-statement-only/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "AssignmentExpression destructuring outside of a ExpressionStatement is forbidden due to current 6to5 limitations"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
var Component = React.createClass({
|
||||
render: function () {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
30
test/util.js
30
test/util.js
@@ -3,8 +3,6 @@ var util = require("../lib/6to5/util");
|
||||
var t = require("../lib/6to5/types");
|
||||
|
||||
suite("util", function () {
|
||||
test("duplicate mutator map");
|
||||
|
||||
test("invalid template", function () {
|
||||
assert.throws(function () {
|
||||
util.template("invalid template");
|
||||
@@ -45,6 +43,34 @@ suite("util", function () {
|
||||
assert.deepEqual(util.list("foo,bar"), ["foo", "bar"]);
|
||||
});
|
||||
|
||||
test("arrayify", function () {
|
||||
assert.deepEqual(util.arrayify(undefined), []);
|
||||
assert.deepEqual(util.arrayify(false), []);
|
||||
assert.deepEqual(util.arrayify(null), []);
|
||||
assert.deepEqual(util.arrayify(""), []);
|
||||
assert.deepEqual(util.arrayify("foo"), ["foo"]);
|
||||
assert.deepEqual(util.arrayify("foo,bar"), ["foo", "bar"]);
|
||||
assert.deepEqual(util.arrayify(["foo", "bar"]), ["foo", "bar"]);
|
||||
|
||||
assert.throws(function () {
|
||||
util.arrayify({});
|
||||
}, /illegal type for arrayify/);
|
||||
});
|
||||
|
||||
test("regexify", function () {
|
||||
assert.deepEqual(util.regexify(undefined), /(?:)/);
|
||||
assert.deepEqual(util.regexify(false), /(?:)/);
|
||||
assert.deepEqual(util.regexify(null), /(?:)/);
|
||||
assert.deepEqual(util.regexify(""), /(?:)/);
|
||||
assert.deepEqual(util.regexify(["foo", "bar"]), /foo|bar/);
|
||||
assert.deepEqual(util.regexify("foobar"), /foobar/);
|
||||
assert.deepEqual(util.regexify(/foobar/), /foobar/);
|
||||
|
||||
assert.throws(function () {
|
||||
util.regexify({});
|
||||
}, /illegal type for regexify/);
|
||||
});
|
||||
|
||||
test("getIds");
|
||||
|
||||
test("toStatement");
|
||||
|
||||
Reference in New Issue
Block a user