exa/xtests
Benjamin Sago 8c34b46a22 Version output changes
• Bring what's shown in the version string in line with my other projects (URL, description, git hash and date for release-mode non-final builds only, potential for colours in the future)
• Show +git or -git depending on feature status
• Tests for the above, and for checking that the command-line flag is warned about
2021-04-03 17:41:48 +01:00
..
features Version output changes 2021-04-03 17:41:48 +01:00
outputs Fix integration tests after merged PRs 2021-04-01 10:19:34 +01:00
attributes.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
colour-term.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
debug-logging.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
details-view-dates.toml More date-related xtests 2020-10-17 21:26:24 +01:00
details-view-filesizes.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
details-view-passwd.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
details-view-permissions.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
details-view.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
dotfiles.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
errors.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
git-ignore.toml More git-ignore xtests 2020-10-17 21:59:15 +01:00
git.toml More git-ignore xtests 2020-10-17 21:59:15 +01:00
grid-details-view.toml Don’t produce extra column sometimes with long grid + header 2021-01-12 20:18:19 +01:00
grid-view.toml Fix argument sorting in test outputs 2021-03-29 23:02:35 +01:00
help.toml Add 'exa: ' before all command-line errors 2021-04-01 11:25:50 +01:00
icons.toml Introduce EXA_ICON_SPACING environment variable 2020-10-24 19:41:07 +01:00
ignore-glob.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
input-options.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
lines-view.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
README.md Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
run.sh Justfile improvements 2021-04-01 09:39:03 +01:00
sorting.toml Fix new tests 2021-01-15 16:45:54 -05:00
themes.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00
tree-view.toml Use Specsheet for the extended tests 2020-10-17 21:12:18 +01:00

exa xtests

These are the extended tests. They are integration tests: they run the exa binary with select configurations of parameters and environment variables, and assert that the program prints the correct text to standard output and error, and exits with the correct status code.

They test things like:

  • broken symlinks
  • extended attributes
  • file names with weird stuff like newlines or escapes in
  • invalid UTF-8
  • missing users and groups
  • nested Git repositories

They are intended to be run from the Vagrant VM that has already had its environment set up — see the devtools/dev-create-test-filesystem.sh script for how the files are generated.

Anatomy of the tests

The tests are run using Specsheet. The TOML files define the tests, and the files in output/ contain the output that exa should produce.

For example, lets look at one of the tests in lines-view.toml. This test checks that running exa does the right thing when running with the -1 argument, and a directory full of files:

[[cmd]]
name = "exa -1 displays file names, one on each line"
shell = "exa -1 /testcases/file-names"
stdout = { file = "outputs/names_lines.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ 'oneline' ]

Heres an explanation of each line:

  1. The [[cmd]] line marks this test as a cmd check, which can run arbitrary commands. In this case, the commad is exa with some arguments.

  2. The name field is a human-readable description of the feature of exa thats under test. It gets printed to the screen as tests are run.

  3. The shell field contains the shell script to execute. It should have exa in there somewhere.

  4. The stdout field describes the content that exa should print to standard output. In this case, the test asserts that the output of running the program should be identical to the contents of the file.

  5. The stderr field describes the content of standard error. In this case, it asserts that nothing is printed to stderr.

  6. The status field asserts that exa should exit with a status code of 0.

  7. The tags field does not change the test at all, but can be used to filter which tests are run, instead of running all of them each time.