Skip to content

Large scale syntax regression tests #1124

@sharkdp

Description

@sharkdp

I would like to set up a test suite that makes sure we don't run into regressions like #963, #914 or #1099.

The way this could work would be to collect a large set of source files for all the different languages that bat can handle (we could start with the ones that are inside "Packages" and require this for new syntaxes in the future). We would then generate the syntax-highlighted versions of these source files via

bat --color=always --plain example.rs > example.rs.highlighted

and store the *.highlighted versions in the repository as well. Finally, we would set up a test (similar to the "snapshot tests") that would compare the output of the current version of bat with these stored versions.

We could use a specialized fixed highlighting theme for these tests, in order for theme changes not to require any updates of these files.

We certainly wouldn't catch all bugs with this method, as it relies on the content of the example files (more content is better, I guess). But we certainly wouldn't be surprised by things like #963, where the syntax highlighting for Markdown was essentially completely broken.

This collection of example files would certainly also be valuable for other sorts of tests. The biggest effort would be to collect these files. A possible source could be http://rosettacode.org/wiki/Rosetta_Code, but licensing needs to be checked.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions