Skip to content

Commit

Permalink
Tests WIP 2
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 16, 2023
1 parent 93fa12d commit 647ffbd
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion test/eval.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('eval', () => {
});
});

describe('in class method', () => {
describe('in class prototype method', () => {
/* eslint-disable class-methods-use-this */
describe('with no prefix num change', () => {
itSerializesEqual('at top level of eval', {
Expand Down Expand Up @@ -315,6 +315,72 @@ describe('eval', () => {
/* eslint-enable class-methods-use-this */
});

describe('in class static method', () => {
describe('with no prefix num change', () => {
itSerializesEqual('at top level of eval', {
in() {
class S {
static meth() { return 123; }
}
class C extends S {
static meth() {
return eval('super.meth()');
}
}
return C.meth();
},
out: '123'
});

itSerializesEqual('within arrow function', {
in() {
class S {
static meth() { return 123; }
}
class C extends S {
static meth() {
return eval('() => super.meth()');
}
}
return C.meth()();
},
out: '123'
});
});

describe('with prefix num change', () => {
itSerializesEqual('at top level of eval', {
in() {
class S {
static meth() { return 123; }
}
class C extends S {
static meth() {
return eval('let livepack_tracker; super.meth()');
}
}
return C.meth();
},
out: '123'
});

itSerializesEqual('within arrow function', {
in() {
class S {
static meth() { return 123; }
}
class C extends S {
static meth() {
return eval('let livepack_tracker; () => super.meth()');
}
}
return C.meth()();
},
out: '123'
});
});
});

describe('in class constructor', () => {
/* eslint-disable class-methods-use-this, constructor-super, no-this-before-super */
describe('with no prefix num change', () => {
Expand Down

0 comments on commit 647ffbd

Please sign in to comment.