Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Refactor #1707

Draft
wants to merge 76 commits into
base: master
Choose a base branch
from
Draft

Testing Refactor #1707

wants to merge 76 commits into from

Conversation

leeyi45
Copy link
Contributor

@leeyi45 leeyi45 commented May 22, 2024

TL; DR

  • Remove the interpreter (alongside non-det)
  • Remove the lazy variant
  • Remove svml-machine.ts
  • Remove remnants of the old type checker
  • Make js-slang tests more robust and simpler

What's going on:

Because our testing utilities relied heavily on the interpreter, removing it means touching almost every single part of js-slang, hence the ridiculous number of lines changed. I've tried to simplify the testing utilities and refactor repetitive code where necessary without breaking anything I hope. For example, I noticed that the stepper's tests were being run as async tests when getEvaluationSteps is no longer asynchronous. Hopefully with these changes it will make such things easier to catch.

I've also configured tsconfig.prod.json to exclude src/utils/testing. Previously this code was being shipped with the rest of js-slang, but given that we only use it for unit testing I don't think it should be included when js-slang is being built.

Given that @martin-henz has indicated that other parts of js-slang are marked for removal, I decided to remove them here to avoid having to refactor the tests for those parts of js-slang.

Please refer to the TODO comments to see what issues need to be addressed before this PR can be merged.

Will resolve these issues:

Some issues that need to be revisited:

RichDom2185 and others added 30 commits January 23, 2024 15:29
Replaces the depended functions with their equivalents.
* Remove interpreter (mostly)
* Redirect testing to use ec-evaluator
* Update snapshots
* Update dependents of interpreter
…-refactor

# Conflicts:
#	src/__tests__/__snapshots__/scmlib.ts.snap
#	src/interpreter/closure.ts
#	src/interpreter/interpreter.ts
#	src/mocks/context.ts
#	src/repl/repl.ts
#	src/runner/sourceRunner.ts
@leeyi45
Copy link
Contributor Author

leeyi45 commented Aug 18, 2024

Just bumping this so that we can try to get this stuff settled

@RichDom2185
Copy link
Member

Just bumping this so that we can try to get this stuff settled

What's left of the PR?

@leeyi45
Copy link
Contributor Author

leeyi45 commented Aug 18, 2024

This remains a draft because there are some critical questions that need to be answered:

  1. Since svml-machine.ts is removed, we need to specify the behaviour for when runInContext is called with Variant.CONCURRENT. The variant has been left in since there are parts of the vm that still rely on it.
  2. String representations of functions in the cse-machine always default to arrow functions. Is this desired behaviour? Because currently the native runner and the cse-machine have different behaviour.
  3. I am wholly unqualified to update src/__tests__/environment.ts. So the snapshot is failing here but I haven't just gone ahead and changed it.
  4. Stepper doesn't actually do type checking: 0 / "a"; doesn't cause it to throw errors. Does something need to be done about this?

One more thing: I have no idea what inspect() or any of those related things do, so I haven't been able to remove things like the Scheduler

Ideally I'd like to remove things like manualToggleDebugger since it doesn't seem like we're using it anymore

@RichDom2185
Copy link
Member

CC: Prof @martin-henz to answer the questions

@leeyi45
Copy link
Contributor Author

leeyi45 commented Aug 19, 2024

I went back to check my 4th point cause it did seem a bit weird to me. I think what I was trying to say is that the stepper will happily evaluate up to the point of a runtime error and js-slang returns a non-errored result value (because the error itself is a step)

# Conflicts:
#	src/cse-machine/__tests__/cse-machine-runtime-context.ts
#	src/stepper/__tests__/__snapshots__/stepper.ts.snap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants