Skip to content

Commit 2631fd6

Browse files
committed
update CSEC tests
Removed the expectation of an empty `Object` class from all tests, since that behaviour is now deprecated. A blank `Object` class will be synthesized instead by utility function.
1 parent bd07203 commit 2631fd6

16 files changed

+9171
-9157
lines changed

src/ec-evaluator/__tests__/__utils__/utils.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Environment } from '../../components'
22
import { STEP_LIMIT } from '../../constants'
3+
import { LFSR } from '../../lib'
34
import { ControlItem, Context, StashItem, StructType } from '../../types'
45
import { Stack, isNode } from '../../utils'
6+
import { makeObjectClass } from '../../index'
57

68
export class StackStub<T> extends Stack<T> {
79
private trace: T[] = []
@@ -17,17 +19,30 @@ export class StackStub<T> extends Stack<T> {
1719
return this.trace
1820
}
1921
}
22+
2023
export class ControlStub extends StackStub<ControlItem> {}
2124
export class StashStub extends StackStub<StashItem> {}
2225
// TODO make env traceable
23-
export class EnvironmentStub extends Environment {}
26+
export class EnvironmentStub extends Environment {
27+
constructor() {
28+
super()
29+
this.defineClass('Object', makeObjectClass())
30+
}
31+
}
2432

2533
export const createContextStub = (): Context => ({
2634
errors: [],
2735
control: new ControlStub(),
2836
stash: new StashStub(),
2937
environment: new EnvironmentStub(),
30-
totalSteps: STEP_LIMIT
38+
totalSteps: STEP_LIMIT,
39+
interfaces: {
40+
stdout: console.log,
41+
stderr: console.error,
42+
statics: {
43+
lfsr: new LFSR('')
44+
}
45+
}
3146
})
3247

3348
export const getControlItemStr = (i: ControlItem): string => {

0 commit comments

Comments
 (0)