-
Notifications
You must be signed in to change notification settings - Fork 18
Upgrade test script #15
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
Conversation
martin-henz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Martin Henz, [8 Apr 2020 at 9:24:43 AM]:
...Nearly there!
Note that there are several source files .js to be tested, in each folder. src//*.js
So we will need one source-test.js file for each of them. So there should be a file
src/steppers/tests/source_0._.js or something like that, instead of your
src/steppers/tests/source-test.js
Can you check in the intended source-test file in steppers/tests , also?
Yes I missed that! A suggestion: we can use the presence of a comment in the first line of the test file (eg. I've added this change and updated the PR description and screenshot. |
martin-henz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are getting very close to something beautiful, here. One more change would allow us to specify the source chapter and variant, with a command line option to the test script. We could do that with a header comment in the test program:
// chap=3 variant=non-det
This way you could use your test framework for testing your non-det examples!
To clarify the command line option, do you mean a command line option for js-slang which takes a variant? |
martin-henz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
I think you did the right thing: an option in the header of the test files that specifies the chapter and variant. |
With this PR,
src/test/framework/main.jscan be used to write tests, and run with the test script.It checks for
source-testat the first line of each test file. If present, it concatenates the source-test framework, the source file and the test file, and runs it with js-slang. Otherwise, it uses the existing test framework.In the following example, the first three tests use the existing test framework while the last six use source-test:

Chapter and variants can also be specified in the first line of each test file, for example:
If they are not specified, their default values are used.