Browse Source

tidy up test

contingency-plan
Rich-Harris 9 years ago
parent
commit
dd93bb9461
  1. 4
      test/function/named-external-method-in-prototype/_config.js
  2. 9
      test/function/named-external-method-in-prototype/foo.js
  3. 4
      test/function/named-external-method-in-prototype/main.js

4
test/function/named-external-method-in-prototype/_config.js

@ -1,5 +1,5 @@
module.exports = {
description: 'method of external named import used inside prototype method',
description: 'method of external named import used inside prototype method (#68)',
context: {
// override require here, making "foo" appear as a global module
require: function ( name ) {
@ -11,5 +11,5 @@ module.exports = {
},
options: {
external: [ 'bar' ]
},
}
};

9
test/function/named-external-method-in-prototype/foo.js

@ -1,16 +1,9 @@
import { bar } from 'bar';
export default function Foo() {
// XXX: one does not even have to call the method, simply having it defined
// on the prototype triggers the failure
//return this.bar();
return bar.foobar();
this.answer = bar.foobar();
}
// XXX: this prototype definition throws it of, comment it out and it at least
// fails at runtime because it generates wrong code
Foo.prototype.bar = function () {
// XXX: it also has to be a nested function, simply calling `bar()` here
// works, or at least it fails ar runtime like the case above
return bar.foobar();
};

4
test/function/named-external-method-in-prototype/main.js

@ -1,5 +1,3 @@
// XXX: it has to be an imported module, otherwise it compiles and fails at
// runtime
import Foo from './foo.js';
assert.equal( new Foo(), 42 );
assert.equal( new Foo().bar(), 42 );

Loading…
Cancel
Save