Skip to content

Commit

Permalink
test(babel-plugin-espower): update expectations since babel separates…
Browse files Browse the repository at this point in the history
… syntax transformation
  • Loading branch information
twada committed Oct 31, 2015
1 parent 0e95022 commit fa3d6a7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 40 deletions.
21 changes: 4 additions & 17 deletions test/fixtures/ClassExpression/expected.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
'use strict';

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

assert((function () {
function Me() {
_classCallCheck(this, Me);
assert(class Me {
getClassName() {
return foo + Me.name;
}

_createClass(Me, [{
key: 'getClassName',
value: function getClassName() {
return foo + Me.name;
}
}]);

return Me;
})());
});
4 changes: 2 additions & 2 deletions test/fixtures/Literal/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ assert(assert._expr(assert._capt('ほげ' !== 'ふが', 'arguments/0'), {
line: 19
}));

assert(503);
assert(0b111110111);

assert(503);
assert(0o767);
12 changes: 5 additions & 7 deletions test/fixtures/SpreadElement/expected.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
'use strict';

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }

assert(assert._expr(assert._capt(hello.apply(undefined, _toConsumableArray(assert._capt(names, 'arguments/0/arguments/0/argument'))), 'arguments/0'), {
assert(assert._expr(assert._capt(hello(...assert._capt(names, 'arguments/0/arguments/0/argument')), 'arguments/0'), {
content: 'assert(hello(...names))',
filepath: 'test/fixtures/SpreadElement/fixture.js',
line: 3
}));

assert(assert._expr(assert._capt(assert._capt([assert._capt(head, 'arguments/0/object/elements/0')].concat(_toConsumableArray(assert._capt(tail, 'arguments/0/object/elements/1/argument'))), 'arguments/0/object').length, 'arguments/0'), {
content: 'assert([head,...tail].length)',
assert(assert._expr(assert._capt(assert._capt([assert._capt(head, 'arguments/0/object/elements/0'), ...assert._capt(tail, 'arguments/0/object/elements/1/argument')], 'arguments/0/object').length, 'arguments/0'), {
content: 'assert([head, ...tail].length)',
filepath: 'test/fixtures/SpreadElement/fixture.js',
line: 5
}));

assert(assert._expr(assert._capt(f.apply(undefined, [assert._capt(head, 'arguments/0/arguments/0')].concat(_toConsumableArray(assert._capt(iter(), 'arguments/0/arguments/1/argument')), _toConsumableArray(assert._capt([assert._capt(foo, 'arguments/0/arguments/2/argument/elements/0'), assert._capt(bar, 'arguments/0/arguments/2/argument/elements/1')], 'arguments/0/arguments/2/argument')))), 'arguments/0'), {
content: 'assert(f(head, ...iter(), ...[foo,bar]))',
assert(assert._expr(assert._capt(f(assert._capt(head, 'arguments/0/arguments/0'), ...assert._capt(iter(), 'arguments/0/arguments/1/argument'), ...assert._capt([assert._capt(foo, 'arguments/0/arguments/2/argument/elements/0'), assert._capt(bar, 'arguments/0/arguments/2/argument/elements/1')], 'arguments/0/arguments/2/argument')), 'arguments/0'), {
content: 'assert(f(head, ...iter(), ...[foo, bar]))',
filepath: 'test/fixtures/SpreadElement/fixture.js',
line: 7
}));
12 changes: 3 additions & 9 deletions test/fixtures/TaggedTemplateExpression/expected.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
'use strict';

var _templateObject = _taggedTemplateLiteral(['a', ''], ['a', '']),
_templateObject2 = _taggedTemplateLiteral(['a', 'b', 'c', ''], ['a', 'b', 'c', '']),
_templateObject3 = _taggedTemplateLiteral(['driver ', ', navigator ', ''], ['driver ', ', navigator ', '']);

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

assert(assert._expr(assert._capt(fn(_templateObject, 1), 'arguments/0'), {
assert(assert._expr(assert._capt(fn`a${ 1 }`, 'arguments/0'), {
content: 'assert(fn`a${ 1 }`)',
filepath: 'test/fixtures/TaggedTemplateExpression/fixture.js',
line: 3
}));

assert(assert._expr(assert._capt(fn(_templateObject2, assert._capt(foo, 'arguments/0/quasi/expressions/0'), assert._capt(bar, 'arguments/0/quasi/expressions/1'), assert._capt(baz, 'arguments/0/quasi/expressions/2')), 'arguments/0'), {
assert(assert._expr(assert._capt(fn`a${ assert._capt(foo, 'arguments/0/quasi/expressions/0') }b${ assert._capt(bar, 'arguments/0/quasi/expressions/1') }c${ assert._capt(baz, 'arguments/0/quasi/expressions/2') }`, 'arguments/0'), {
content: 'assert(fn`a${ foo }b${ bar }c${ baz }`)',
filepath: 'test/fixtures/TaggedTemplateExpression/fixture.js',
line: 5
}));

assert(assert._expr(assert._capt(fn(_templateObject3, assert._capt(assert._capt(bob, 'arguments/0/quasi/expressions/0/object').name, 'arguments/0/quasi/expressions/0'), assert._capt(assert._capt(alice, 'arguments/0/quasi/expressions/1/callee/object').getName(), 'arguments/0/quasi/expressions/1')), 'arguments/0'), {
assert(assert._expr(assert._capt(fn`driver ${ assert._capt(assert._capt(bob, 'arguments/0/quasi/expressions/0/object').name, 'arguments/0/quasi/expressions/0') }, navigator ${ assert._capt(assert._capt(alice, 'arguments/0/quasi/expressions/1/callee/object').getName(), 'arguments/0/quasi/expressions/1') }`, 'arguments/0'), {
content: 'assert(fn`driver ${ bob.name }, navigator ${ alice.getName() }`)',
filepath: 'test/fixtures/TaggedTemplateExpression/fixture.js',
line: 7
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/TemplateLiteral/expected.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict';

assert(assert._expr(assert._capt('Hello', 'arguments/0'), {
assert(assert._expr(assert._capt(`Hello`, 'arguments/0'), {
content: 'assert(`Hello`)',
filepath: 'test/fixtures/TemplateLiteral/fixture.js',
line: 3
}));

assert(assert._expr(assert._capt('Hello, ' + assert._capt(nickname, 'arguments/0/expressions/0'), 'arguments/0'), {
assert(assert._expr(assert._capt(`Hello, ${ assert._capt(nickname, 'arguments/0/expressions/0') }`, 'arguments/0'), {
content: 'assert(`Hello, ${ nickname }`)',
filepath: 'test/fixtures/TemplateLiteral/fixture.js',
line: 5
}));

assert(assert._expr(assert._capt('Hello, ' + assert._capt(assert._capt(user, 'arguments/0/expressions/0/object').nickname, 'arguments/0/expressions/0'), 'arguments/0'), {
assert(assert._expr(assert._capt(`Hello, ${ assert._capt(assert._capt(user, 'arguments/0/expressions/0/object').nickname, 'arguments/0/expressions/0') }`, 'arguments/0'), {
content: 'assert(`Hello, ${ user.nickname }`)',
filepath: 'test/fixtures/TemplateLiteral/fixture.js',
line: 7
Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/inputSourceMap/expected.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

var Person, assert;

assert = require('power-assert');
Expand Down

0 comments on commit fa3d6a7

Please sign in to comment.