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

Tokenization testing #4

Merged
merged 22 commits into from
Jul 10, 2024
Merged

Tokenization testing #4

merged 22 commits into from
Jul 10, 2024

Conversation

sungshik
Copy link
Collaborator

@sungshik sungshik commented Jul 9, 2024

Previously, only structural properties of generated TextMate grammars could conveniently be tested from within Rascal (e.g., expected number of rules). This PR adds the infra to test also behavioral properties (i.e., expected tokenization of example input text).

Specifically, the vscode-tmgrammar-test tool is used to: (1) tokenize example input text using generated TextMate grammars; (2) compare actual tokenization against expected tokenization. The tool uses the same tokenization engine as VS Code.

CI is updated accordingly.

@@ -1,7 +1,7 @@
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file are due to the "extra" change in this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it's going to be a blast of a merge conflict with my other small PR. which might be a reason to pull those changes out of this PR and apply them on main after merging that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged main into this branch, then resolved all conflicts in favor of main, then regenerated the file

@sungshik sungshik marked this pull request as ready for review July 9, 2024 16:12
@sungshik sungshik requested a review from DavyLandman July 9, 2024 16:12
Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I would try and use package.json to do some of the "command" stuff.

@@ -23,6 +23,10 @@ jobs:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- uses: actions/setup-node@v4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add which version of node we need. and enable caching to improve CI times.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

node_modules
package-lock.json
package.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally package.json is not in the .gitignore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -0,0 +1,3 @@
npx vscode-tmgrammar-test ^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the bat is the exact same.

how about we move it to package.json in the run block. and in rascal we just use npm run conversion-tests ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed:

  • Call npx directly from Rascal instead of via the scripts
  • Remove the scripts

@@ -1,7 +1,7 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it's going to be a blast of a merge conflict with my other small PR. which might be a reason to pull those changes out of this PR and apply them on main after merging that?

@sungshik sungshik merged commit 2e58856 into main Jul 10, 2024
2 checks passed
@sungshik sungshik deleted the tokenization-testing branch July 10, 2024 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants