Using Markdown for a startup test is useful since it has so many dependencies on
other syntaxes. So such a test makes sure that lazy-loading of syntaxes work.
It is however also useful to measure the startup time of bat when the time to
load a syntax is very small, and the measured startup time has mostly non-syntax
related causes. Such as:
* Parsing arguments
* Setting up syntax mapping
* Loading themes
This commit adds such a test. It uses the CpuInfo syntax which is very small.
Only 14 lines, compared to the 1581 lines that Markdown is (not including the
size of its included syntaxes).
This command can be used to get an approximation of the size of syntaxes, and
thus how expensive they are to load:
find -name *.sublime-syntax -print0 | xargs --null wc -l | sort -n -r
The file `LiveScript.sublime-syntax` is a pure export from a licenced version
of Sublime Text, Version 3.1.1, Build 3176 with
assets/syntaxes/02_Extra/LiveScript/Syntaxes/LiveScript.tmLanguage as the source
file.
* syntax-tests: Make CpuInfo test actually work
File extension matching is case-sensitive, so extension needs to be .cpuinfo for
the syntax to actually be used.
* Also fix MemInfo
We want to make sure that all of our test environments are clean from
possible outside modification. This consolidates the list of used
environment variables in Rust-based and Python-based integration tests.
Note that there is also a similar list in `src/bin/bat/main.rs` which
is even more exhaustive (for bug report collection). However, some
of these variables can not possibly have an effect on test environments.
Or rather, introduce new versions of these methods and deprecate the old ones.
This is preparation to enable robust and user-friendly support for lazy-loading.
With lazy-loading, we don't know if the SyntaxSet is valid until after we try to
use it, so wherever we try to use it, we need to return a Result. See discussion
about panics in #1747.
The syntax is named "Man Page" upstream, but our man page syntax is
different, it's for rendered man pages. Rename to Groff and remove
`.man` from extensions.