Skip to content

Automatically generate expected JSON for .test files #2401

@RunDevelopment

Description

@RunDevelopment

Motivation
Writing test files, while important, has always been a pain. I made #1801 because I got tired of having to format the token stream by hand.
I'm even lazier now and want the test runner to insert the token stream for me.

Jokes aside, the basic idea is that you only need to add some code and a description and the test runner will insert the JSON itself. This makes it a lot easier to create test files because you don't even have to copy-paste the token stream anymore, you just accept the highlighting as correct.
Updating the test files after small changes (e.g. adding a few new keywords) will also be easier.

I think that this may lead to test files with errors since the developer no longer has to look at the token stream (though, it is questionable that devs look at the token stream when copy-pasting it).

Description
Add a CLI option --insert to npm run test:languages that will automatically insert the actual token stream in .test files where the actual and the accept token stream aren't equal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions