diff --git a/Cargo.lock b/Cargo.lock index c1db77b..d4b549c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" [[package]] name = "libgit2-sys" -version = "0.12.13+1.0.1" +version = "0.12.14+1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069eea34f76ec15f2822ccf78fe0cdb8c9016764d0a12865278585a74dbdeae5" +checksum = "8f25af58e6495f7caf2919d08f212de550cfa3ed2f5e744988938ea292b9f549" dependencies = [ "cc", "libc", @@ -247,9 +247,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "openssl-src" -version = "111.11.0+1.1.1h" +version = "111.12.0+1.1.1h" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380fe324132bea01f45239fadfec9343adb044615f29930d039bec1ae7b9fa5b" +checksum = "858a4132194f8570a7ee9eb8629e85b23cbc4565f2d4a162e87556e5956abf61" dependencies = [ "cc", ] @@ -285,9 +285,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pkg-config" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "redox_syscall" diff --git a/Justfile b/Justfile index f7e5cc9..c5e1e67 100644 --- a/Justfile +++ b/Justfile @@ -1,5 +1,5 @@ -all: build test -all-release: build-release test-release +all: build test xtests +all-release: build-release test-release xtests-release # compiles the exa binary @@ -28,6 +28,15 @@ all-release: build-release test-release cargo hack test --feature-powerset -- --quiet +# runs extended tests +@xtests: + xtests/run.sh + +# runs extended tests (using the release mode exa) +@xtests-release: + xtests/run.sh --release + + # lints the code @clippy: touch src/main.rs diff --git a/Vagrantfile b/Vagrantfile index 1802141..09d525d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,5 +1,3 @@ -require 'date' - Vagrant.configure(2) do |config| # We use Ubuntu instead of Debian because the image comes with two-way diff --git a/devtools/dev-create-test-filesystem.sh b/devtools/dev-create-test-filesystem.sh index 68d8ad6..d42e714 100755 --- a/devtools/dev-create-test-filesystem.sh +++ b/devtools/dev-create-test-filesystem.sh @@ -20,6 +20,7 @@ fi sudo mkdir "$TEST_ROOT" sudo chmod 777 "$TEST_ROOT" +sudo mkdir "$TEST_ROOT/empty" # Awkward file size testcases. @@ -302,6 +303,10 @@ mkdir "deeply/nested/repository" cd "deeply/nested/repository" git init >/dev/null touch subfile +# This file, ‘subfile’, should _not_ be marked as a new file by exa, because +# it’s in the sub-repository but hasn’t been added to it. Were the sub-repo not +# present, it would be marked as a new file, as the top-level repo knows about +# the ‘deeply’ directory. find "$TEST_ROOT/git2" -exec touch {} -t $FIXED_DATE \; sudo chown $FIXED_USER:$FIXED_USER -R "$TEST_ROOT/git2" @@ -332,6 +337,7 @@ shopt -u dotglob GLOBIGNORE=".:.." mkdir "$TEST_ROOT/hiddens" +cd "$TEST_ROOT/hiddens" touch "$TEST_ROOT/hiddens/visible" touch "$TEST_ROOT/hiddens/.hidden" touch "$TEST_ROOT/hiddens/..extra-hidden" diff --git a/xtests/README.md b/xtests/README.md index ea7b3c5..e2d0788 100644 --- a/xtests/README.md +++ b/xtests/README.md @@ -1,4 +1,47 @@ -## Extra tests +# exa › xtests -These extra tests are intended to be run from a Vagrant VM that has already had its environment set up -- see the section in the README for more details. +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](https://specsheet.software/). The TOML files define the tests, and the files in `output/` contain the output that exa should produce. + +For example, let’s 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: + +```toml +[[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' ] +``` + +Here’s an explanation of each line: + +1. The `[[cmd]]` line marks this test as a [cmd](https://specsheet.software/checks/command/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 that’s 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](https://specsheet.software/docs/check-file-schema#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. diff --git a/xtests/attributes.toml b/xtests/attributes.toml new file mode 100644 index 0000000..3ac2fe0 --- /dev/null +++ b/xtests/attributes.toml @@ -0,0 +1,42 @@ +[[cmd]] +name = "‘exa -@lT’ produces a tree view with metadata and attribute entries" +shell = "exa -@lT /testcases/attributes" +stdout = { file = "outputs/attributes_xattrs_long_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'xattrs', 'long', 'tree' ] + +[[cmd]] +name = "‘exa -@T’ produces a tree view with attribute entries" +shell = "exa -@T /testcases/attributes" +stdout = { file = "outputs/attributes_xattrs_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'xattrs', 'tree' ] + +[[cmd]] +name = "‘exa -@T’ with file arguments produces a tree view with attribute entries" +shell = "exa -@T /testcases/attributes/*" +stdout = { file = "outputs/attributes_files_xattrs_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'xattrs', 'tree' ] + +[[cmd]] +name = "‘exa -@T’ produces a tree view with attribute entries of symlinks" +shell = "exa -@T /testcases/links" +stdout = { file = "outputs/links_xattrs_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'xattrs', 'tree' ] + + +# permission errors tests + +[[cmd]] +name = "‘exa -@T’ displays an inaccessible directory with errors" +shell = "exa -@T /proc/1/root" +stdout = { file = "outputs/proc_1_root_xattrs.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'tree' ] diff --git a/xtests/colour-term.toml b/xtests/colour-term.toml new file mode 100644 index 0000000..fafab3a --- /dev/null +++ b/xtests/colour-term.toml @@ -0,0 +1,57 @@ +# details view (check the argument works) + +[[cmd]] +name = "‘exa -l --colour=always’ always uses colours for metadata" +shell = "exa -l --colour=always /testcases/files" +stdout = { file = "outputs/files_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-term' ] + +[[cmd]] +name = "‘exa -l --colour=never’ never uses colours for metadata" +shell = "exa -l --colour=never /testcases/files" +stdout = { file = "outputs/files_long_monochrome.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-term' ] + +[[cmd]] +name = "‘exa -l --colour=automatic’ uses colours dependently for metadata" +shell = "exa -l --colour=automatic /testcases/files" +stdout = { file = "outputs/files_long_monochrome.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-term' ] + + +# grid view (check that all colours are turned off) + +[[cmd]] +name = "‘exa --colour=never’ never uses colours for file names" +shell = "exa --colour=never /testcases/file-names" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/files_grid_monochrome.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'grid', 'colour-term' ] + +[[cmd]] +name = "‘exa --colour=never’ never uses colours for files based on their extensions" +shell = "exa --colour=never /testcases/file-names-exts" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/exts_grid_monochrome.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'grid', 'colour-term' ] + + +# tree view (check that all colours are turned off) + +[[cmd]] +name = "‘exa -T --colour=never’ never uses colours for punctuation and symlink targets" +shell = "exa -T --colour=never /testcases/file-names/links" +stdout = { file = "outputs/links_grid_monochrome.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'tree', 'colour-term' ] diff --git a/xtests/dates_accessed b/xtests/dates_accessed deleted file mode 100644 index a6cf3ed..0000000 --- a/xtests/dates_accessed +++ /dev/null @@ -1,4 +0,0 @@ -Permissions Size User Date Accessed Name -.rw-rw-r-- 0 cassowary  3 Mar 2003 plum -.rw-rw-r-- 0 cassowary 15 Jun 2006 pear -.rw-rw-r-- 0 cassowary 22 Dec 2009 peach diff --git a/xtests/dates_deifidom b/xtests/dates_deifidom deleted file mode 100644 index d16bf18..0000000 --- a/xtests/dates_deifidom +++ /dev/null @@ -1,4 +0,0 @@ -Permissions Size User Date Modified Name -.rw-rw-r-- 0 cassowary 22 Dec 2009 plum -.rw-rw-r-- 0 cassowary 15 Jun 2006 peach -.rw-rw-r-- 0 cassowary  3 Mar 2003 pear diff --git a/xtests/dates_modified b/xtests/dates_modified deleted file mode 100644 index bde011f..0000000 --- a/xtests/dates_modified +++ /dev/null @@ -1,4 +0,0 @@ -Permissions Size User Date Modified Name -.rw-rw-r-- 0 cassowary  3 Mar 2003 pear -.rw-rw-r-- 0 cassowary 15 Jun 2006 peach -.rw-rw-r-- 0 cassowary 22 Dec 2009 plum diff --git a/xtests/debug-logging.toml b/xtests/debug-logging.toml new file mode 100644 index 0000000..cb12da7 --- /dev/null +++ b/xtests/debug-logging.toml @@ -0,0 +1,17 @@ +[[cmd]] +name = "‘EXA_DEBUG=1 exa’ produces debug output" +shell = "exa --long /testcases" +environment = { EXA_DEBUG = "1" } +stdout = { empty = false } +stderr = { string = "DEBUG" } +status = 0 +tags = [ 'debug', 'env', 'long' ] + +[[cmd]] +name = "‘EXA_DEBUG=trace exa’ produces trace-level debug output" +shell = "exa --long /testcases" +environment = { EXA_DEBUG = "trace" } +stdout = { empty = false } +stderr = { string = "TRACE" } +status = 0 +tags = [ 'debug', 'env', 'long' ] diff --git a/xtests/details-view-dates.toml b/xtests/details-view-dates.toml new file mode 100644 index 0000000..9fe3e10 --- /dev/null +++ b/xtests/details-view-dates.toml @@ -0,0 +1,46 @@ +# alternate date formats + +[[cmd]] +name = "‘exa -l --time-style=long-iso’ produces a table using the long-iso date format" +shell = "exa -l --time-style=long-iso /testcases/dates" +stdout = { file = "outputs/dates_long_timestyle_longiso.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'time-style' ] + +[[cmd]] +name = "‘exa -l --time-style=full-iso’ produces a table using the full-iso date format" +shell = "exa -l --time-style=full-iso /testcases/dates" +stdout = { file = "outputs/dates_long_timestyle_fulliso.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'time-style' ] + +[[cmd]] +name = "‘exa -l --time-style=iso’ produces a table using the iso date format" +shell = "exa -l --time-style=iso /testcases/dates" +stdout = { file = "outputs/dates_long_timestyle_iso.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'time-style' ] + + +# locales + +[[cmd]] +name = "‘exa -l’ using a locale with 4-character-long month abbreviations (‘ja_JP’) sizes the date column correctly" +shell = "exa -l /testcases/dates" +environment = { LC_ALL = "ja_JP.UTF-8", LANG = "ja_JP.UTF-8" } +stdout = { file = "outputs/dates_long_localejp.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'locales' ] + +[[cmd]] +name = "‘exa -l’ using a locale with 5-character-long month abbreviations (‘fr_FR’) sizes the date column correctly" +shell = "exa -l /testcases/dates" +environment = { LC_ALL = "fr_FR.UTF-8", LANG = "fr_FR.UTF-8" } +stdout = { file = "outputs/dates_long_localefr.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'locales' ] diff --git a/xtests/details-view-filesizes.toml b/xtests/details-view-filesizes.toml new file mode 100644 index 0000000..6682d25 --- /dev/null +++ b/xtests/details-view-filesizes.toml @@ -0,0 +1,63 @@ +[[cmd]] +name = "‘exa -lb’ produces a details table with binary file sizes" +shell = "exa -lb /testcases/files" +stdout = { file = "outputs/files_long_binary.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'binary' ] + +[[cmd]] +name = "‘exa -lB’ produces a details table with bytes file sizes" +shell = "exa -lB /testcases/files" +stdout = { file = "outputs/files_long_bytes.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'bytes' ] + +[[cmd]] +name = "‘exa -lhb’ produces a details table with a header and binary file sizes" +shell = "exa -lhb /testcases/files" +stdout = { file = "outputs/files_long_header_binary.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'header', 'binary' ] + +[[cmd]] +name = "‘exa -lhB’ produces a details table with a header and bytes file sizes" +shell = "exa -lhB /testcases/files" +stdout = { file = "outputs/files_long_header_bytes.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'header', 'bytes' ] + +[[cmd]] +name = "‘exa -l --color-scale’ (US spelling) produces a details table using a file size colour scale" +shell = "exa -l --color-scale /testcases/files" +stdout = { file = "outputs/files_long_colourscale.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-scale' ] + +[[cmd]] +name = "‘exa -l --colour-scale’ (UK spelling) produces a details table using a file size colour scale" +shell = "exa -l --colour-scale /testcases/files" +stdout = { file = "outputs/files_long_colourscale.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-scale' ] + +[[cmd]] +name = "‘exa -l --colour-scale --binary’ produces a details table using a file size colour scale and binary sizes" +shell = "exa -l --colour-scale --binary /testcases/files" +stdout = { file = "outputs/files_long_colourscale_binary.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-scale', 'binary' ] + +[[cmd]] +name = "‘exa -l --colour-scale --bytes’ produces a details table using a file size colour scale and byte sizes" +shell = "exa -l --colour-scale --bytes /testcases/files" +stdout = { file = "outputs/files_long_colourscale_bytes.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'colour-scale', 'bytes' ] diff --git a/xtests/details-view-passwd.toml b/xtests/details-view-passwd.toml new file mode 100644 index 0000000..c73057d --- /dev/null +++ b/xtests/details-view-passwd.toml @@ -0,0 +1,7 @@ +[[cmd]] +name = "‘exa -lgh’ produces a tree view with attribute entries" +shell = "exa -lgh /testcases/passwd" +stdout = { file = "outputs/passwd_long_group_header.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'group', 'header' ] diff --git a/xtests/details-view-permissions.toml b/xtests/details-view-permissions.toml new file mode 100644 index 0000000..68c3b28 --- /dev/null +++ b/xtests/details-view-permissions.toml @@ -0,0 +1,15 @@ +[[cmd]] +name = "‘exa -lghR’ (not as the user) produces a tree view with attribute entries" +shell = "exa -lghR /testcases/permissions" +stdout = { file = "outputs/permissions_long_group_header.ansitxt" } +stderr = { string = "/testcases/permissions/forbidden-directory: Permission denied (os error 13)" } +status = 0 +tags = [ 'long', 'group', 'header', 'xattrs' ] + +[[cmd]] +name = "‘exa -lghR’ (as the user) produces a tree view with attribute entries" +shell = "sudo -u cassowary exa -lghR /testcases/permissions" +stdout = { file = "outputs/permissions_long_group_header_sudo.ansitxt" } +stderr = { string = "/testcases/permissions/forbidden-directory: Permission denied (os error 13)" } +status = 0 +tags = [ 'long', 'group', 'header', 'xattrs', 'sudo' ] diff --git a/xtests/details-view.toml b/xtests/details-view.toml new file mode 100644 index 0000000..331fa58 --- /dev/null +++ b/xtests/details-view.toml @@ -0,0 +1,45 @@ +[[cmd]] +name = "‘exa -l’ produces a details table" +shell = "exa -l /testcases/files" +stdout = { file = "outputs/files_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long' ] + + +# header tests + +[[cmd]] +name = "‘exa -lh’ produces a details table with a header" +shell = "exa -lh /testcases/files" +stdout = { file = "outputs/files_long_header.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'header' ] + +[[cmd]] +name = "‘exa -lh’ with an empty directory skips the header" +shell = "exa -lh /testcases/empty" +stdout = { empty = true } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'header' ] + + +# file kinds + +[[cmd]] +name = "‘exa -l’ handles file kinds" +shell = "exa -l /testcases/specials" +stdout = { file = "outputs/specials_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long' ] + +[[cmd]] +name = "‘exa -lF’ handles and classifies file kinds" +shell = "exa -lF /testcases/specials" +stdout = { file = "outputs/specials_long_classify.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'classify' ] diff --git a/xtests/dir_paths b/xtests/dir_paths deleted file mode 100644 index 39279fe..0000000 --- a/xtests/dir_paths +++ /dev/null @@ -1,3 +0,0 @@ -target -target/debug -target/debug/build diff --git a/xtests/dotfiles.toml b/xtests/dotfiles.toml new file mode 100644 index 0000000..650d69c --- /dev/null +++ b/xtests/dotfiles.toml @@ -0,0 +1,58 @@ +# hidden files in grid view + +[[cmd]] +name = "‘exa’ does not show hidden files (in grid view)" +shell = "exa /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_grid.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'grid' ] + +[[cmd]] +name = "‘exa -a’ shows hidden files (in grid view)" +shell = "exa -a /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_grid_all.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'grid' ] + +[[cmd]] +name = "‘exa -aa’ shows hidden files, ., and .. (in grid view)" +shell = "exa -aa /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_grid_all_all.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'grid' ] + + +# hidden files in long view + +[[cmd]] +name = "‘exa -l’ does not show hidden files (in details view)" +shell = "exa -l /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'long' ] + +[[cmd]] +name = "‘exa -la’ shows hidden files (in details view)" +shell = "exa -la /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_long_all.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'long' ] + +[[cmd]] +name = "‘exa -laa’ shows hidden files, ., and .. (in details view)" +shell = "exa -laa /testcases/hiddens" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/hiddens_long_all_all.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'all', 'long' ] diff --git a/xtests/empty b/xtests/empty deleted file mode 100644 index e69de29..0000000 diff --git a/xtests/error_duplicate b/xtests/error_duplicate deleted file mode 100644 index 9ef8ce7..0000000 --- a/xtests/error_duplicate +++ /dev/null @@ -1 +0,0 @@ -Flag -l conflicts with flag --long diff --git a/xtests/error_long b/xtests/error_long deleted file mode 100644 index a3bad30..0000000 --- a/xtests/error_long +++ /dev/null @@ -1 +0,0 @@ -Unknown argument --ternary diff --git a/xtests/error_lt b/xtests/error_lt deleted file mode 100644 index b7bb341..0000000 --- a/xtests/error_lt +++ /dev/null @@ -1,2 +0,0 @@ -Flag -t needs a value (choices: modified, changed, accessed, created) -To sort newest files last, try "--sort newest", or just "-snew" diff --git a/xtests/error_ltr b/xtests/error_ltr deleted file mode 100644 index 6f8cfb2..0000000 --- a/xtests/error_ltr +++ /dev/null @@ -1,2 +0,0 @@ -Option --time (-t) has no "r" setting (choices: modified, changed, accessed, created) -To sort oldest files last, try "--sort oldest", or just "-sold" diff --git a/xtests/error_overvalued b/xtests/error_overvalued deleted file mode 100644 index b8510a3..0000000 --- a/xtests/error_overvalued +++ /dev/null @@ -1 +0,0 @@ -Flag --long cannot take a value diff --git a/xtests/error_setting b/xtests/error_setting deleted file mode 100644 index 86d828b..0000000 --- a/xtests/error_setting +++ /dev/null @@ -1 +0,0 @@ -Option --time-style has no "24" setting (choices: default, long-iso, full-iso, iso) diff --git a/xtests/error_short b/xtests/error_short deleted file mode 100644 index 1f60b16..0000000 --- a/xtests/error_short +++ /dev/null @@ -1 +0,0 @@ -Unknown argument -4 diff --git a/xtests/error_twice b/xtests/error_twice deleted file mode 100644 index 99ef3fd..0000000 --- a/xtests/error_twice +++ /dev/null @@ -1 +0,0 @@ -Flag -l was given twice diff --git a/xtests/error_useless b/xtests/error_useless deleted file mode 100644 index 08e4e63..0000000 --- a/xtests/error_useless +++ /dev/null @@ -1 +0,0 @@ -Option --binary (-b) is useless without option --long (-l) diff --git a/xtests/error_value b/xtests/error_value deleted file mode 100644 index 3125de3..0000000 --- a/xtests/error_value +++ /dev/null @@ -1 +0,0 @@ -Flag --time needs a value (choices: modified, changed, accessed, created) diff --git a/xtests/errors.toml b/xtests/errors.toml new file mode 100644 index 0000000..150e73e --- /dev/null +++ b/xtests/errors.toml @@ -0,0 +1,17 @@ +# Error suggestions + +[[cmd]] +name = "‘exa -ltr’ offers a suggestion" +shell = "exa -ltr" +stdout = { empty = true } +stderr = { string = "To sort oldest files last, try \"--sort oldest\", or just \"-sold\""} +status = 3 +tags = [ 'error', 'long', 'sort' ] + +[[cmd]] +name = "‘exa -lt’ offers a suggestion" +shell = "exa -lt" +stdout = { empty = true } +stderr = { string = "To sort newest files last, try \"--sort newest\", or just \"-snew\""} +status = 3 +tags = [ 'error', 'long', 'sort' ] diff --git a/xtests/file_names_T@ b/xtests/file_names_T@ deleted file mode 100644 index 528e4b3..0000000 --- a/xtests/file_names_T@ +++ /dev/null @@ -1,29 +0,0 @@ -/testcases/file-names -├── ansi: [\u{1b}[34mblue\u{1b}[0m] -├── ascii: hello -├── backspace: [\u{8}] -├── bell: [\u{7}] -├── emoji: [🆒] -├── escape: [\u{1b}] -├── form-feed: [\u{c}] -├── invalid-utf8-1: [�] -│ └──  -├── invalid-utf8-2: [�(] -│ └──  -├── invalid-utf8-3: [�(] -│ └──  -├── invalid-utf8-4: [�(�(] -│ └──  -├── links -│ ├── another: [\n] -> /testcases/file-names/new-line-dir: [\n]/another: [\n] -│ ├── broken -> /testcases/file-names/new-line-dir: [\n]/broken -│ │ └──  -│ └── subfile -> /testcases/file-names/new-line-dir: [\n]/subfile -├── new-line-dir: [\n] -│ ├── another: [\n] -│ └── subfile -├── new-line: [\n] -├── return: [\r] -├── tab: [\t] -├── utf-8: pâté -└── vertical-tab: [\u{b}] diff --git a/xtests/files_120 b/xtests/files_120 deleted file mode 100644 index cb1da3c..0000000 --- a/xtests/files_120 +++ /dev/null @@ -1,3 +0,0 @@ -1_bytes 2_bytes 3_bytes 4_bytes 5_bytes 6_bytes 7_bytes 8_bytes 9_bytes 10_bytes 11_bytes 12_bytes 13_bytes -1_KiB 2_KiB 3_KiB 4_KiB 5_KiB 6_KiB 7_KiB 8_KiB 9_KiB 10_KiB 11_KiB 12_KiB 13_KiB -1_MiB 2_MiB 3_MiB 4_MiB 5_MiB 6_MiB 7_MiB 8_MiB 9_MiB 10_MiB 11_MiB 12_MiB 13_MiB diff --git a/xtests/files_160 b/xtests/files_160 deleted file mode 100644 index cb1da3c..0000000 --- a/xtests/files_160 +++ /dev/null @@ -1,3 +0,0 @@ -1_bytes 2_bytes 3_bytes 4_bytes 5_bytes 6_bytes 7_bytes 8_bytes 9_bytes 10_bytes 11_bytes 12_bytes 13_bytes -1_KiB 2_KiB 3_KiB 4_KiB 5_KiB 6_KiB 7_KiB 8_KiB 9_KiB 10_KiB 11_KiB 12_KiB 13_KiB -1_MiB 2_MiB 3_MiB 4_MiB 5_MiB 6_MiB 7_MiB 8_MiB 9_MiB 10_MiB 11_MiB 12_MiB 13_MiB diff --git a/xtests/files_lG_80 b/xtests/files_lG_80 deleted file mode 100644 index d20ddfa..0000000 --- a/xtests/files_lG_80 +++ /dev/null @@ -1,39 +0,0 @@ -.rw-r--r-- 1 cassowary  1 Jan 12:34 1_bytes -.rw-r--r-- 1.0k cassowary  1 Jan 12:34 1_KiB -.rw-r--r-- 1.0M cassowary  1 Jan 12:34 1_MiB -.rw-r--r-- 2 cassowary  1 Jan 12:34 2_bytes -.rw-r--r-- 2.0k cassowary  1 Jan 12:34 2_KiB -.rw-r--r-- 2.1M cassowary  1 Jan 12:34 2_MiB -.rw-r--r-- 3 cassowary  1 Jan 12:34 3_bytes -.rw-r--r-- 3.1k cassowary  1 Jan 12:34 3_KiB -.rw-r--r-- 3.1M cassowary  1 Jan 12:34 3_MiB -.rw-r--r-- 4 cassowary  1 Jan 12:34 4_bytes -.rw-r--r-- 4.1k cassowary  1 Jan 12:34 4_KiB -.rw-r--r-- 4.2M cassowary  1 Jan 12:34 4_MiB -.rw-r--r-- 5 cassowary  1 Jan 12:34 5_bytes -.rw-r--r-- 5.1k cassowary  1 Jan 12:34 5_KiB -.rw-r--r-- 5.2M cassowary  1 Jan 12:34 5_MiB -.rw-r--r-- 6 cassowary  1 Jan 12:34 6_bytes -.rw-r--r-- 6.1k cassowary  1 Jan 12:34 6_KiB -.rw-r--r-- 6.3M cassowary  1 Jan 12:34 6_MiB -.rw-r--r-- 7 cassowary  1 Jan 12:34 7_bytes -.rw-r--r-- 7.2k cassowary  1 Jan 12:34 7_KiB -.rw-r--r-- 7.3M cassowary  1 Jan 12:34 7_MiB -.rw-r--r-- 8 cassowary  1 Jan 12:34 8_bytes -.rw-r--r-- 8.2k cassowary  1 Jan 12:34 8_KiB -.rw-r--r-- 8.4M cassowary  1 Jan 12:34 8_MiB -.rw-r--r-- 9 cassowary  1 Jan 12:34 9_bytes -.rw-r--r-- 9.2k cassowary  1 Jan 12:34 9_KiB -.rw-r--r-- 9.4M cassowary  1 Jan 12:34 9_MiB -.rw-r--r-- 10 cassowary  1 Jan 12:34 10_bytes -.rw-r--r-- 10k cassowary  1 Jan 12:34 10_KiB -.rw-r--r-- 10M cassowary  1 Jan 12:34 10_MiB -.rw-r--r-- 11 cassowary  1 Jan 12:34 11_bytes -.rw-r--r-- 11k cassowary  1 Jan 12:34 11_KiB -.rw-r--r-- 11M cassowary  1 Jan 12:34 11_MiB -.rw-r--r-- 12 cassowary  1 Jan 12:34 12_bytes -.rw-r--r-- 12k cassowary  1 Jan 12:34 12_KiB -.rw-r--r-- 12M cassowary  1 Jan 12:34 12_MiB -.rw-r--r-- 13 cassowary  1 Jan 12:34 13_bytes -.rw-r--r-- 13k cassowary  1 Jan 12:34 13_KiB -.rw-r--r-- 13M cassowary  1 Jan 12:34 13_MiB diff --git a/xtests/git.toml b/xtests/git.toml new file mode 100644 index 0000000..d0aae9c --- /dev/null +++ b/xtests/git.toml @@ -0,0 +1,202 @@ +# The first Git repo: additions and modifications + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column" +shell = "exa --git -l /testcases/git" +stdout = { file = "outputs/git1_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lR’ shows a Git status column in every table" +shell = "exa --git -lR /testcases/git" +stdout = { file = "outputs/git1_long_recurse.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lT’ shows a Git status column alongside the tree" +shell = "exa --git -lT /testcases/git" +stdout = { file = "outputs/git1_long_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ with a directory argument shows the combined Git status column" +shell = "exa --git -l /testcases/git/moves/thither" +stdout = { file = "outputs/git1_long_moves.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column containing new files" +shell = "exa --git -l /testcases/git/additions" +stdout = { file = "outputs/git1_long_additions.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column containing modified files" +shell = "exa --git -l /testcases/git/edits" +stdout = { file = "outputs/git1_long_edits.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column containing multiple statuses" +shell = "exa --git -l /testcases/git/{additions,edits}" +stdout = { file = "outputs/git1_long_multiple.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lGd’ with file arguments shows a Git status column" +shell = "exa --git -lGd /testcases/git/**/* /testcases" +environment = { COLUMNS = "150" } +stdout = { file = "outputs/git1_paths_long_grid.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'grid', 'git', 'list-dirs' ] + + +# The second Git repo: nested repositories and file ignoring + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column with ignored statuses" +shell = "exa --git -l /testcases/git2" +stdout = { file = "outputs/git2_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lR’ shows a Git status column in every table, handling ignored files and nested repositories" +shell = "exa --git -lR /testcases/git2" +stdout = { file = "outputs/git2_long_recurse.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lT’ shows a Git status column alongside the tree, handling ignored files and nested repositories" +shell = "exa --git -lT /testcases/git2" +stdout = { file = "outputs/git2_long_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ with a directory argument shows ignored flags inside a directory" +shell = "exa --git -l /testcases/git2/ignoreds" +stdout = { file = "outputs/git2_long_ignorednested.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ with an ignored directory argument does not flag the contents as ignored" +shell = "exa --git -l /testcases/git2/target" +stdout = { file = "outputs/git2_long_ignoreddir.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ with a nested repository argument uses the sub-repository rules" +shell = "exa --git -l /testcases/git2/deeply/nested/repository" +stdout = { file = "outputs/git2_long_nested.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ with multiple directory arguments still gets the flags correct" +shell = "exa --git -l /testcases/git2/{deeply,ignoreds,target}" +stdout = { file = "outputs/git2_long_multiple.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + + +# The third Git repo: broken symlinks + +[[cmd]] +name = "‘exa --git -l’ handles broken symlinks in Git repositories" +shell = "exa --git -l /testcases/git3" +stdout = { file = "outputs/git3_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + + +# Both repositories 1 and 2 at once + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column for multiple repositories" +shell = "exa --git -l /testcases/git /testcases/git2" +stdout = { file = "outputs/git1+2_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column for multiple repositories across multiple directories" +shell = "exa --git -l /testcases/{git/additions,git2/deeply,git/edits,git2/deeply/nested}" +stdout = { file = "outputs/git1+2_long_directories.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -l’ shows a Git status column for multiple repositories across multiple directories" +shell = "exa --git -l /testcases/{git2/deeply/nested/directory,git/edits,git2/target,git2/deeply,git}" +stdout = { file = "outputs/git1+2_long_nested.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + + +# No repository present + +[[cmd]] +name = "‘exa --git -l’ shows an empty status for no repository" +shell = "exa --git -l /testcases/files" +stdout = { file = "outputs/files_long.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git' ] + +[[cmd]] +name = "‘exa --git -lG’ shows an empty status for no repository" +shell = "exa --git -lG /testcases/files" +environment = { COLUMNS = "40" } +stdout = { file = "outputs/files_long_grid_1col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid', 'git' ] + + +# Git-ignoring + +[[cmd]] +name = "‘exa --git-ignore -lR’ skips Git-ignored files" +shell = "exa --git-ignore -lR /testcases/git2" +stdout = { file = "outputs/git2_long_recurse_gitignore.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git-ignore' ] + +[[cmd]] +name = "‘exa --git-ignore -lT’ skips Git-ignored files" +shell = "exa --git-ignore -lT /testcases/git2" +stdout = { file = "outputs/git2_long_tree_gitignore.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'git-ignore' ] diff --git a/xtests/git_1_nogit b/xtests/git_1_nogit deleted file mode 100644 index 42500ad..0000000 --- a/xtests/git_1_nogit +++ /dev/null @@ -1,3 +0,0 @@ -drwxrwxr-x - cassowary  1 Jan 12:34 additions -drwxrwxr-x - cassowary  1 Jan 12:34 edits -drwxrwxr-x - cassowary  1 Jan 12:34 moves diff --git a/xtests/git_2_nogit b/xtests/git_2_nogit deleted file mode 100644 index 74fb129..0000000 --- a/xtests/git_2_nogit +++ /dev/null @@ -1,3 +0,0 @@ -drwxrwxr-x - cassowary  1 Jan 12:34 deeply -drwxrwxr-x - cassowary  1 Jan 12:34 ignoreds -drwxrwxr-x - cassowary  1 Jan 12:34 target diff --git a/xtests/grid-details-view.toml b/xtests/grid-details-view.toml new file mode 100644 index 0000000..c307e0c --- /dev/null +++ b/xtests/grid-details-view.toml @@ -0,0 +1,78 @@ +# listing directory tests + +[[cmd]] +name = "‘COLUMNS=40 exa -lG’ produces a grid with details of 1 column" +shell = "exa -lG /testcases/files" +environment = { COLUMNS = "40" } +stdout = { file = "outputs/files_long_grid_1col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=80 exa -lG’ produces a grid with details of 1 column" +shell = "exa -lG /testcases/files" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/files_long_grid_1col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=120 exa -lG’ produces a grid with details of 2 columns" +shell = "exa -lG /testcases/files" +environment = { COLUMNS = "120" } +stdout = { file = "outputs/files_long_grid_2col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=160 exa -lG’ produces a grid with details of 3 columns" +shell = "exa -lG /testcases/files" +environment = { COLUMNS = "160" } +stdout = { file = "outputs/files_long_grid_3col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=200 exa -lG’ produces a grid with details of 4 columns" +shell = "exa -lG /testcases/files" +environment = { COLUMNS = "200" } +stdout = { file = "outputs/files_long_grid_4col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + + +# listing files tests +# (these rely on bash’s glob sort order) +# (some of the output files also have trailing whitespace) + +[[cmd]] +name = "‘COLUMNS=100 exa -lG’ with file arguments produces a grid with details of 1 column, with full paths" +shell = "exa -lG /testcases/files/*" +environment = { COLUMNS = "100" } +stdout = { file = "outputs/files_paths_long_grid_1col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=150 exa -lG’ with file arguments produces a grid with details of 2 columns, with full paths" +shell = "exa -lG /testcases/files/*" +environment = { COLUMNS = "150" } +stdout = { file = "outputs/files_paths_long_grid_2col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=200 exa -lG’ with file arguments produces a grid with details of 3 columns, with full paths" +shell = "exa -lG /testcases/files/*" +environment = { COLUMNS = "200" } +stdout = { file = "outputs/files_paths_long_grid_3col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'long', 'grid' ] diff --git a/xtests/grid-view.toml b/xtests/grid-view.toml new file mode 100644 index 0000000..5f9a0d7 --- /dev/null +++ b/xtests/grid-view.toml @@ -0,0 +1,124 @@ +# file name tests + +[[cmd]] +name = "‘exa’ produces a grid of file names" +shell = "exa /testcases/file-names" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/names_grid.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘exa -x’ produces an across grid of file names" +shell = "exa -x /testcases/file-names" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/names_grid_across.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid', 'across' ] + + +# recurse tests + +[[cmd]] +name = "‘exa -R’ produces several grids of file names" +shell = "exa -R /testcases/file-names" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/names_grid_recurse.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid', 'recurse' ] + + +# symlink tests + +[[cmd]] +name = "‘exa’ highlights symlinks and broken symlinks" +shell = "exa /testcases/links" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/links_grid.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + + + +# columns and width tests + +[[cmd]] +name = "‘COLUMNS=40 exa’ produces a grid of 4 columns" +shell = "exa /testcases/files" +environment = { COLUMNS = "40" } +stdout = { file = "outputs/files_grid_4col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=80 exa’ produces a grid of 8 columns" +shell = "exa /testcases/files" +environment = { COLUMNS = "80" } +stdout = { file = "outputs/files_grid_8col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=120 exa’ produces a grid of 13 columns" +shell = "exa /testcases/files" +environment = { COLUMNS = "120" } +stdout = { file = "outputs/files_grid_13col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=160 exa’ produces a grid of 13 columns" +shell = "exa /testcases/files" +environment = { COLUMNS = "160" } +stdout = { file = "outputs/files_grid_13col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=200 exa’ produces a grid of 20 columns" +shell = "exa /testcases/files" +environment = { COLUMNS = "200" } +stdout = { file = "outputs/files_grid_20col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + + +# columns and width tests with files +# (these rely on bash’s glob sort order) +# (some of the output files also have trailing whitespace) + +[[cmd]] +name = "‘COLUMNS=100 exa’ with file arguments produces a grid of 3 columns, with full paths" +shell = "exa /testcases/files/*" +environment = { COLUMNS = "100" } +stdout = { file = "outputs/files_paths_grid_3col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=150 exa’ with file arguments produces a grid of 5 columns, with full paths" +shell = "exa /testcases/files/*" +environment = { COLUMNS = "150" } +stdout = { file = "outputs/files_paths_grid_5col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] + +[[cmd]] +name = "‘COLUMNS=200 exa’ with file arguments produces a grid of 7 columns, with full paths" +shell = "exa /testcases/files/*" +environment = { COLUMNS = "200" } +stdout = { file = "outputs/files_paths_grid_7col.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'env', 'grid' ] diff --git a/xtests/help.toml b/xtests/help.toml new file mode 100644 index 0000000..39bba28 --- /dev/null +++ b/xtests/help.toml @@ -0,0 +1,7 @@ +[[cmd]] +name = "‘exa --help’ produces the correct help text" +shell = "exa --help" +stdout = { file = "outputs/help.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'help '] diff --git a/xtests/ignore-glob.toml b/xtests/ignore-glob.toml new file mode 100644 index 0000000..ae62d7a --- /dev/null +++ b/xtests/ignore-glob.toml @@ -0,0 +1,15 @@ +[[cmd]] +name = "‘exa -1 -I’ ignores based on a glob" +shell = "exa -1 -I '*.OGG' /testcases/file-names-exts/music.*" +stdout = { string = "music.mp3" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'ignore' ] + +[[cmd]] +name = "‘exa -1 -I’ ignores based on multiple globs" +shell = "exa -1 -I '*.OGG|*.mp3' /testcases/file-names-exts/music.*" +stdout = { empty = true } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'ignore' ] diff --git a/xtests/ignores_ogg b/xtests/ignores_ogg deleted file mode 100644 index d54732c..0000000 --- a/xtests/ignores_ogg +++ /dev/null @@ -1 +0,0 @@ -/testcases/file-names-exts/music.mp3 diff --git a/xtests/input-options.toml b/xtests/input-options.toml new file mode 100644 index 0000000..6961a4e --- /dev/null +++ b/xtests/input-options.toml @@ -0,0 +1,77 @@ +[[cmd]] +name = "exa can handle invalid UTF-8 in command-line arguments" +shell = "exa /testcases/file-names/*" +stdout = { empty = false } +stderr = { empty = true } +status = 0 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays an error for an unknown short option" +shell = "exa -4" +stdout = { empty = true } +stderr = { string = "Unknown argument -4" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays an error for an unknown long option" +shell = "exa --ternary" +stdout = { empty = true } +stderr = { string = "Unknown argument --ternary" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays an error for an option missing a parameter" +shell = "exa --time" +stdout = { empty = true } +stderr = { string = "Flag --time needs a value (choices: modified, changed, accessed, created)" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays an error for an option that cannot take a parameter has one" +shell = "exa --long=time" +stdout = { empty = true } +stderr = { string = "Flag --long cannot take a value" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays an error for option that takes the wrong parameter" +shell = "exa -l --time-style=24" +stdout = { empty = true } +stderr = { string = "Option --time-style has no \"24\" setting (choices: default, long-iso, full-iso, iso)" } +status = 3 +tags = [ 'options' ] + + +# strict mode settings + +[[cmd]] +name = "exa displays a warning for a useless option in strict mode" +shell = "exa --binary" +environment = { EXA_STRICT = "1" } +stdout = { empty = true } +stderr = { string = "Option --binary (-b) is useless without option --long (-l)" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays a warning for a short option given twice in strict mode" +shell = "exa -ll" +environment = { EXA_STRICT = "1" } +stdout = { empty = true } +stderr = { string = "Flag -l was given twice" } +status = 3 +tags = [ 'options' ] + +[[cmd]] +name = "exa displays a warning for a short option also given as long in strict mode" +shell = "exa -l --long" +environment = { EXA_STRICT = "1" } +stdout = { empty = true } +stderr = { string = "Flag -l conflicts with flag --long" } +status = 3 +tags = [ 'options' ] diff --git a/xtests/lines-view.toml b/xtests/lines-view.toml new file mode 100644 index 0000000..f0d7979 --- /dev/null +++ b/xtests/lines-view.toml @@ -0,0 +1,36 @@ +# file name tests + +[[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' ] + +[[cmd]] +name = "‘exa -1d’ displays, ‘.’, ‘..’, and ‘/’ correctly" +shell = "exa -1d . .. /" +stdout = { file = "outputs/dirs_oneline.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'list-dirs' ] + + +# symlinks tests + +[[cmd]] +name = "‘exa -1’ lists the destination of symlinks" +shell = "exa -1 /testcases/links" +stdout = { file = "outputs/links_lines.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline' ] + +[[cmd]] +name = "‘exa -1d’ with file arguments lists the destination of symlinks" +shell = "exa -1d /testcases/links/*" +stdout = { file = "outputs/links_paths_lines.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'list-dirs' ] diff --git a/xtests/attributes_files b/xtests/outputs/attributes_files_xattrs_tree.ansitxt similarity index 100% rename from xtests/attributes_files rename to xtests/outputs/attributes_files_xattrs_tree.ansitxt diff --git a/xtests/attributes b/xtests/outputs/attributes_xattrs_long_tree.ansitxt similarity index 100% rename from xtests/attributes rename to xtests/outputs/attributes_xattrs_long_tree.ansitxt diff --git a/xtests/attributes_dir b/xtests/outputs/attributes_xattrs_tree.ansitxt similarity index 100% rename from xtests/attributes_dir rename to xtests/outputs/attributes_xattrs_tree.ansitxt diff --git a/xtests/dates_fr b/xtests/outputs/dates_long_localefr.ansitxt similarity index 100% rename from xtests/dates_fr rename to xtests/outputs/dates_long_localefr.ansitxt diff --git a/xtests/dates_jp b/xtests/outputs/dates_long_localejp.ansitxt similarity index 100% rename from xtests/dates_jp rename to xtests/outputs/dates_long_localejp.ansitxt diff --git a/xtests/dates_full_iso b/xtests/outputs/dates_long_timestyle_fulliso.ansitxt similarity index 100% rename from xtests/dates_full_iso rename to xtests/outputs/dates_long_timestyle_fulliso.ansitxt diff --git a/xtests/dates_iso b/xtests/outputs/dates_long_timestyle_iso.ansitxt similarity index 100% rename from xtests/dates_iso rename to xtests/outputs/dates_long_timestyle_iso.ansitxt diff --git a/xtests/dates_long_iso b/xtests/outputs/dates_long_timestyle_longiso.ansitxt similarity index 100% rename from xtests/dates_long_iso rename to xtests/outputs/dates_long_timestyle_longiso.ansitxt diff --git a/xtests/dirs b/xtests/outputs/dirs_oneline.ansitxt similarity index 100% rename from xtests/dirs rename to xtests/outputs/dirs_oneline.ansitxt diff --git a/xtests/themed_compresseds b/xtests/outputs/exts_compressed_paths_themed.ansitxt similarity index 100% rename from xtests/themed_compresseds rename to xtests/outputs/exts_compressed_paths_themed.ansitxt diff --git a/xtests/themed_compresseds_r b/xtests/outputs/exts_compressed_paths_themed_reset.ansitxt similarity index 100% rename from xtests/themed_compresseds_r rename to xtests/outputs/exts_compressed_paths_themed_reset.ansitxt diff --git a/xtests/file-names-exts-bw b/xtests/outputs/exts_grid_monochrome.ansitxt similarity index 100% rename from xtests/file-names-exts-bw rename to xtests/outputs/exts_grid_monochrome.ansitxt diff --git a/xtests/file-names-exts-ext b/xtests/outputs/exts_oneline_sort_ext.ansitxt similarity index 100% rename from xtests/file-names-exts-ext rename to xtests/outputs/exts_oneline_sort_ext.ansitxt diff --git a/xtests/file-names-exts-ext-case b/xtests/outputs/exts_oneline_sort_extcase.ansitxt similarity index 100% rename from xtests/file-names-exts-ext-case rename to xtests/outputs/exts_oneline_sort_extcase.ansitxt diff --git a/xtests/file-names-exts b/xtests/outputs/exts_oneline_sort_name.ansitxt similarity index 100% rename from xtests/file-names-exts rename to xtests/outputs/exts_oneline_sort_name.ansitxt diff --git a/xtests/file-names-exts-case b/xtests/outputs/exts_oneline_sort_namecase.ansitxt similarity index 100% rename from xtests/file-names-exts-case rename to xtests/outputs/exts_oneline_sort_namecase.ansitxt diff --git a/xtests/themed_un b/xtests/outputs/exts_themed_reset.ansitxt similarity index 100% rename from xtests/themed_un rename to xtests/outputs/exts_themed_reset.ansitxt diff --git a/xtests/files b/xtests/outputs/files_grid_13col.ansitxt similarity index 100% rename from xtests/files rename to xtests/outputs/files_grid_13col.ansitxt diff --git a/xtests/files_200 b/xtests/outputs/files_grid_20col.ansitxt similarity index 100% rename from xtests/files_200 rename to xtests/outputs/files_grid_20col.ansitxt diff --git a/xtests/files_40 b/xtests/outputs/files_grid_4col.ansitxt similarity index 100% rename from xtests/files_40 rename to xtests/outputs/files_grid_4col.ansitxt diff --git a/xtests/files_80 b/xtests/outputs/files_grid_8col.ansitxt similarity index 100% rename from xtests/files_80 rename to xtests/outputs/files_grid_8col.ansitxt diff --git a/xtests/file_names_bw b/xtests/outputs/files_grid_monochrome.ansitxt similarity index 100% rename from xtests/file_names_bw rename to xtests/outputs/files_grid_monochrome.ansitxt diff --git a/xtests/files_l b/xtests/outputs/files_long.ansitxt similarity index 100% rename from xtests/files_l rename to xtests/outputs/files_long.ansitxt diff --git a/xtests/files_l_binary b/xtests/outputs/files_long_binary.ansitxt similarity index 100% rename from xtests/files_l_binary rename to xtests/outputs/files_long_binary.ansitxt diff --git a/xtests/files_l_bytes b/xtests/outputs/files_long_bytes.ansitxt similarity index 100% rename from xtests/files_l_bytes rename to xtests/outputs/files_long_bytes.ansitxt diff --git a/xtests/files_l_scale b/xtests/outputs/files_long_colourscale.ansitxt similarity index 100% rename from xtests/files_l_scale rename to xtests/outputs/files_long_colourscale.ansitxt diff --git a/xtests/outputs/files_long_colourscale_binary.ansitxt b/xtests/outputs/files_long_colourscale_binary.ansitxt new file mode 100644 index 0000000..4180fd2 --- /dev/null +++ b/xtests/outputs/files_long_colourscale_binary.ansitxt @@ -0,0 +1,39 @@ +.rw-r--r-- 1 cassowary  1 Jan 12:34 1_bytes +.rw-r--r-- 1.0Ki cassowary  1 Jan 12:34 1_KiB +.rw-r--r-- 1.0Mi cassowary  1 Jan 12:34 1_MiB +.rw-r--r-- 2 cassowary  1 Jan 12:34 2_bytes +.rw-r--r-- 2.0Ki cassowary  1 Jan 12:34 2_KiB +.rw-r--r-- 2.0Mi cassowary  1 Jan 12:34 2_MiB +.rw-r--r-- 3 cassowary  1 Jan 12:34 3_bytes +.rw-r--r-- 3.0Ki cassowary  1 Jan 12:34 3_KiB +.rw-r--r-- 3.0Mi cassowary  1 Jan 12:34 3_MiB +.rw-r--r-- 4 cassowary  1 Jan 12:34 4_bytes +.rw-r--r-- 4.0Ki cassowary  1 Jan 12:34 4_KiB +.rw-r--r-- 4.0Mi cassowary  1 Jan 12:34 4_MiB +.rw-r--r-- 5 cassowary  1 Jan 12:34 5_bytes +.rw-r--r-- 5.0Ki cassowary  1 Jan 12:34 5_KiB +.rw-r--r-- 5.0Mi cassowary  1 Jan 12:34 5_MiB +.rw-r--r-- 6 cassowary  1 Jan 12:34 6_bytes +.rw-r--r-- 6.0Ki cassowary  1 Jan 12:34 6_KiB +.rw-r--r-- 6.0Mi cassowary  1 Jan 12:34 6_MiB +.rw-r--r-- 7 cassowary  1 Jan 12:34 7_bytes +.rw-r--r-- 7.0Ki cassowary  1 Jan 12:34 7_KiB +.rw-r--r-- 7.0Mi cassowary  1 Jan 12:34 7_MiB +.rw-r--r-- 8 cassowary  1 Jan 12:34 8_bytes +.rw-r--r-- 8.0Ki cassowary  1 Jan 12:34 8_KiB +.rw-r--r-- 8.0Mi cassowary  1 Jan 12:34 8_MiB +.rw-r--r-- 9 cassowary  1 Jan 12:34 9_bytes +.rw-r--r-- 9.0Ki cassowary  1 Jan 12:34 9_KiB +.rw-r--r-- 9.0Mi cassowary  1 Jan 12:34 9_MiB +.rw-r--r-- 10 cassowary  1 Jan 12:34 10_bytes +.rw-r--r-- 10Ki cassowary  1 Jan 12:34 10_KiB +.rw-r--r-- 10Mi cassowary  1 Jan 12:34 10_MiB +.rw-r--r-- 11 cassowary  1 Jan 12:34 11_bytes +.rw-r--r-- 11Ki cassowary  1 Jan 12:34 11_KiB +.rw-r--r-- 11Mi cassowary  1 Jan 12:34 11_MiB +.rw-r--r-- 12 cassowary  1 Jan 12:34 12_bytes +.rw-r--r-- 12Ki cassowary  1 Jan 12:34 12_KiB +.rw-r--r-- 12Mi cassowary  1 Jan 12:34 12_MiB +.rw-r--r-- 13 cassowary  1 Jan 12:34 13_bytes +.rw-r--r-- 13Ki cassowary  1 Jan 12:34 13_KiB +.rw-r--r-- 13Mi cassowary  1 Jan 12:34 13_MiB diff --git a/xtests/outputs/files_long_colourscale_bytes.ansitxt b/xtests/outputs/files_long_colourscale_bytes.ansitxt new file mode 100644 index 0000000..e93cfbf --- /dev/null +++ b/xtests/outputs/files_long_colourscale_bytes.ansitxt @@ -0,0 +1,39 @@ +.rw-r--r-- 1 cassowary  1 Jan 12:34 1_bytes +.rw-r--r-- 1,024 cassowary  1 Jan 12:34 1_KiB +.rw-r--r-- 1,048,576 cassowary  1 Jan 12:34 1_MiB +.rw-r--r-- 2 cassowary  1 Jan 12:34 2_bytes +.rw-r--r-- 2,048 cassowary  1 Jan 12:34 2_KiB +.rw-r--r-- 2,097,152 cassowary  1 Jan 12:34 2_MiB +.rw-r--r-- 3 cassowary  1 Jan 12:34 3_bytes +.rw-r--r-- 3,072 cassowary  1 Jan 12:34 3_KiB +.rw-r--r-- 3,145,728 cassowary  1 Jan 12:34 3_MiB +.rw-r--r-- 4 cassowary  1 Jan 12:34 4_bytes +.rw-r--r-- 4,096 cassowary  1 Jan 12:34 4_KiB +.rw-r--r-- 4,194,304 cassowary  1 Jan 12:34 4_MiB +.rw-r--r-- 5 cassowary  1 Jan 12:34 5_bytes +.rw-r--r-- 5,120 cassowary  1 Jan 12:34 5_KiB +.rw-r--r-- 5,242,880 cassowary  1 Jan 12:34 5_MiB +.rw-r--r-- 6 cassowary  1 Jan 12:34 6_bytes +.rw-r--r-- 6,144 cassowary  1 Jan 12:34 6_KiB +.rw-r--r-- 6,291,456 cassowary  1 Jan 12:34 6_MiB +.rw-r--r-- 7 cassowary  1 Jan 12:34 7_bytes +.rw-r--r-- 7,168 cassowary  1 Jan 12:34 7_KiB +.rw-r--r-- 7,340,032 cassowary  1 Jan 12:34 7_MiB +.rw-r--r-- 8 cassowary  1 Jan 12:34 8_bytes +.rw-r--r-- 8,192 cassowary  1 Jan 12:34 8_KiB +.rw-r--r-- 8,388,608 cassowary  1 Jan 12:34 8_MiB +.rw-r--r-- 9 cassowary  1 Jan 12:34 9_bytes +.rw-r--r-- 9,216 cassowary  1 Jan 12:34 9_KiB +.rw-r--r-- 9,437,184 cassowary  1 Jan 12:34 9_MiB +.rw-r--r-- 10 cassowary  1 Jan 12:34 10_bytes +.rw-r--r-- 10,240 cassowary  1 Jan 12:34 10_KiB +.rw-r--r-- 10,485,760 cassowary  1 Jan 12:34 10_MiB +.rw-r--r-- 11 cassowary  1 Jan 12:34 11_bytes +.rw-r--r-- 11,264 cassowary  1 Jan 12:34 11_KiB +.rw-r--r-- 11,534,336 cassowary  1 Jan 12:34 11_MiB +.rw-r--r-- 12 cassowary  1 Jan 12:34 12_bytes +.rw-r--r-- 12,288 cassowary  1 Jan 12:34 12_KiB +.rw-r--r-- 12,582,912 cassowary  1 Jan 12:34 12_MiB +.rw-r--r-- 13 cassowary  1 Jan 12:34 13_bytes +.rw-r--r-- 13,312 cassowary  1 Jan 12:34 13_KiB +.rw-r--r-- 13,631,488 cassowary  1 Jan 12:34 13_MiB diff --git a/xtests/files_lG_40 b/xtests/outputs/files_long_grid_1col.ansitxt similarity index 100% rename from xtests/files_lG_40 rename to xtests/outputs/files_long_grid_1col.ansitxt diff --git a/xtests/files_lG_120 b/xtests/outputs/files_long_grid_2col.ansitxt similarity index 100% rename from xtests/files_lG_120 rename to xtests/outputs/files_long_grid_2col.ansitxt diff --git a/xtests/files_lG_160 b/xtests/outputs/files_long_grid_3col.ansitxt similarity index 100% rename from xtests/files_lG_160 rename to xtests/outputs/files_long_grid_3col.ansitxt diff --git a/xtests/files_lG_200 b/xtests/outputs/files_long_grid_4col.ansitxt similarity index 100% rename from xtests/files_lG_200 rename to xtests/outputs/files_long_grid_4col.ansitxt diff --git a/xtests/files_lh b/xtests/outputs/files_long_header.ansitxt similarity index 100% rename from xtests/files_lh rename to xtests/outputs/files_long_header.ansitxt diff --git a/xtests/files_lhb b/xtests/outputs/files_long_header_binary.ansitxt similarity index 100% rename from xtests/files_lhb rename to xtests/outputs/files_long_header_binary.ansitxt diff --git a/xtests/files_lhb2 b/xtests/outputs/files_long_header_bytes.ansitxt similarity index 100% rename from xtests/files_lhb2 rename to xtests/outputs/files_long_header_bytes.ansitxt diff --git a/xtests/files_l_bw b/xtests/outputs/files_long_monochrome.ansitxt similarity index 100% rename from xtests/files_l_bw rename to xtests/outputs/files_long_monochrome.ansitxt diff --git a/xtests/files_star_100 b/xtests/outputs/files_paths_grid_3col.ansitxt similarity index 100% rename from xtests/files_star_100 rename to xtests/outputs/files_paths_grid_3col.ansitxt diff --git a/xtests/files_star_150 b/xtests/outputs/files_paths_grid_5col.ansitxt similarity index 100% rename from xtests/files_star_150 rename to xtests/outputs/files_paths_grid_5col.ansitxt diff --git a/xtests/files_star_200 b/xtests/outputs/files_paths_grid_7col.ansitxt similarity index 100% rename from xtests/files_star_200 rename to xtests/outputs/files_paths_grid_7col.ansitxt diff --git a/xtests/files_star_lG_100 b/xtests/outputs/files_paths_long_grid_1col.ansitxt similarity index 100% rename from xtests/files_star_lG_100 rename to xtests/outputs/files_paths_long_grid_1col.ansitxt diff --git a/xtests/files_star_lG_150 b/xtests/outputs/files_paths_long_grid_2col.ansitxt similarity index 100% rename from xtests/files_star_lG_150 rename to xtests/outputs/files_paths_long_grid_2col.ansitxt diff --git a/xtests/files_star_lG_200 b/xtests/outputs/files_paths_long_grid_3col.ansitxt similarity index 100% rename from xtests/files_star_lG_200 rename to xtests/outputs/files_paths_long_grid_3col.ansitxt diff --git a/xtests/git_12 b/xtests/outputs/git1+2_long.ansitxt similarity index 100% rename from xtests/git_12 rename to xtests/outputs/git1+2_long.ansitxt diff --git a/xtests/git_1212 b/xtests/outputs/git1+2_long_directories.ansitxt similarity index 100% rename from xtests/git_1212 rename to xtests/outputs/git1+2_long_directories.ansitxt diff --git a/xtests/git_21221 b/xtests/outputs/git1+2_long_nested.ansitxt similarity index 100% rename from xtests/git_21221 rename to xtests/outputs/git1+2_long_nested.ansitxt diff --git a/xtests/git_1_long b/xtests/outputs/git1_long.ansitxt similarity index 100% rename from xtests/git_1_long rename to xtests/outputs/git1_long.ansitxt diff --git a/xtests/git_1_additions b/xtests/outputs/git1_long_additions.ansitxt similarity index 100% rename from xtests/git_1_additions rename to xtests/outputs/git1_long_additions.ansitxt diff --git a/xtests/git_1_edits b/xtests/outputs/git1_long_edits.ansitxt similarity index 100% rename from xtests/git_1_edits rename to xtests/outputs/git1_long_edits.ansitxt diff --git a/xtests/git_1_file b/xtests/outputs/git1_long_moves.ansitxt similarity index 100% rename from xtests/git_1_file rename to xtests/outputs/git1_long_moves.ansitxt diff --git a/xtests/git_1_both b/xtests/outputs/git1_long_multiple.ansitxt similarity index 100% rename from xtests/git_1_both rename to xtests/outputs/git1_long_multiple.ansitxt diff --git a/xtests/git_1_recurse b/xtests/outputs/git1_long_recurse.ansitxt similarity index 100% rename from xtests/git_1_recurse rename to xtests/outputs/git1_long_recurse.ansitxt diff --git a/xtests/git_1_tree b/xtests/outputs/git1_long_tree.ansitxt similarity index 100% rename from xtests/git_1_tree rename to xtests/outputs/git1_long_tree.ansitxt diff --git a/xtests/git_1_files b/xtests/outputs/git1_paths_long_grid.ansitxt similarity index 100% rename from xtests/git_1_files rename to xtests/outputs/git1_paths_long_grid.ansitxt diff --git a/xtests/git_2_long b/xtests/outputs/git2_long.ansitxt similarity index 100% rename from xtests/git_2_long rename to xtests/outputs/git2_long.ansitxt diff --git a/xtests/git_2_target b/xtests/outputs/git2_long_ignoreddir.ansitxt similarity index 100% rename from xtests/git_2_target rename to xtests/outputs/git2_long_ignoreddir.ansitxt diff --git a/xtests/git_2_ignoreds b/xtests/outputs/git2_long_ignorednested.ansitxt similarity index 100% rename from xtests/git_2_ignoreds rename to xtests/outputs/git2_long_ignorednested.ansitxt diff --git a/xtests/git_2_all b/xtests/outputs/git2_long_multiple.ansitxt similarity index 100% rename from xtests/git_2_all rename to xtests/outputs/git2_long_multiple.ansitxt diff --git a/xtests/git_2_repository b/xtests/outputs/git2_long_nested.ansitxt similarity index 100% rename from xtests/git_2_repository rename to xtests/outputs/git2_long_nested.ansitxt diff --git a/xtests/git_2_recurse b/xtests/outputs/git2_long_recurse.ansitxt similarity index 100% rename from xtests/git_2_recurse rename to xtests/outputs/git2_long_recurse.ansitxt diff --git a/xtests/git_2_ignore_recurse b/xtests/outputs/git2_long_recurse_gitignore.ansitxt similarity index 100% rename from xtests/git_2_ignore_recurse rename to xtests/outputs/git2_long_recurse_gitignore.ansitxt diff --git a/xtests/git_2_tree b/xtests/outputs/git2_long_tree.ansitxt similarity index 100% rename from xtests/git_2_tree rename to xtests/outputs/git2_long_tree.ansitxt diff --git a/xtests/git_2_ignore_tree b/xtests/outputs/git2_long_tree_gitignore.ansitxt similarity index 100% rename from xtests/git_2_ignore_tree rename to xtests/outputs/git2_long_tree_gitignore.ansitxt diff --git a/xtests/outputs/git3_long.ansitxt b/xtests/outputs/git3_long.ansitxt new file mode 100644 index 0000000..03cd30d --- /dev/null +++ b/xtests/outputs/git3_long.ansitxt @@ -0,0 +1 @@ +lrwxrwxrwx 9 cassowary 17 Oct 14:27 -N b -> aaa/aaa/a diff --git a/xtests/help b/xtests/outputs/help.ansitxt similarity index 100% rename from xtests/help rename to xtests/outputs/help.ansitxt diff --git a/xtests/hiddens b/xtests/outputs/hiddens_grid.ansitxt similarity index 100% rename from xtests/hiddens rename to xtests/outputs/hiddens_grid.ansitxt diff --git a/xtests/hiddens_a b/xtests/outputs/hiddens_grid_all.ansitxt similarity index 100% rename from xtests/hiddens_a rename to xtests/outputs/hiddens_grid_all.ansitxt diff --git a/xtests/hiddens_aa b/xtests/outputs/hiddens_grid_all_all.ansitxt similarity index 100% rename from xtests/hiddens_aa rename to xtests/outputs/hiddens_grid_all_all.ansitxt diff --git a/xtests/hiddens_l b/xtests/outputs/hiddens_long.ansitxt similarity index 100% rename from xtests/hiddens_l rename to xtests/outputs/hiddens_long.ansitxt diff --git a/xtests/hiddens_la b/xtests/outputs/hiddens_long_all.ansitxt similarity index 100% rename from xtests/hiddens_la rename to xtests/outputs/hiddens_long_all.ansitxt diff --git a/xtests/hiddens_laa b/xtests/outputs/hiddens_long_all_all.ansitxt similarity index 100% rename from xtests/hiddens_laa rename to xtests/outputs/hiddens_long_all_all.ansitxt diff --git a/xtests/links b/xtests/outputs/links_grid.ansitxt similarity index 100% rename from xtests/links rename to xtests/outputs/links_grid.ansitxt diff --git a/xtests/links_bw b/xtests/outputs/links_grid_monochrome.ansitxt similarity index 100% rename from xtests/links_bw rename to xtests/outputs/links_grid_monochrome.ansitxt diff --git a/xtests/links_1 b/xtests/outputs/links_lines.ansitxt similarity index 100% rename from xtests/links_1 rename to xtests/outputs/links_lines.ansitxt diff --git a/xtests/sort-by-type b/xtests/outputs/links_oneline_sort_type.ansitxt similarity index 100% rename from xtests/sort-by-type rename to xtests/outputs/links_oneline_sort_type.ansitxt diff --git a/xtests/themed_links b/xtests/outputs/links_oneline_themed.ansitxt similarity index 100% rename from xtests/themed_links rename to xtests/outputs/links_oneline_themed.ansitxt diff --git a/xtests/links_1_files b/xtests/outputs/links_paths_lines.ansitxt similarity index 100% rename from xtests/links_1_files rename to xtests/outputs/links_paths_lines.ansitxt diff --git a/xtests/links_T b/xtests/outputs/links_tree.ansitxt similarity index 100% rename from xtests/links_T rename to xtests/outputs/links_tree.ansitxt diff --git a/xtests/links_T@ b/xtests/outputs/links_xattrs_tree.ansitxt similarity index 100% rename from xtests/links_T@ rename to xtests/outputs/links_xattrs_tree.ansitxt diff --git a/xtests/file_names b/xtests/outputs/names_grid.ansitxt similarity index 100% rename from xtests/file_names rename to xtests/outputs/names_grid.ansitxt diff --git a/xtests/file_names_x b/xtests/outputs/names_grid_across.ansitxt similarity index 100% rename from xtests/file_names_x rename to xtests/outputs/names_grid_across.ansitxt diff --git a/xtests/file_names_R b/xtests/outputs/names_grid_recurse.ansitxt similarity index 100% rename from xtests/file_names_R rename to xtests/outputs/names_grid_recurse.ansitxt diff --git a/xtests/file_names_1 b/xtests/outputs/names_lines.ansitxt similarity index 100% rename from xtests/file_names_1 rename to xtests/outputs/names_lines.ansitxt diff --git a/xtests/file_names_T b/xtests/outputs/names_tree.ansitxt similarity index 100% rename from xtests/file_names_T rename to xtests/outputs/names_tree.ansitxt diff --git a/xtests/passwd b/xtests/outputs/passwd_long_group_header.ansitxt similarity index 100% rename from xtests/passwd rename to xtests/outputs/passwd_long_group_header.ansitxt diff --git a/xtests/permissions b/xtests/outputs/permissions_long_group_header.ansitxt similarity index 97% rename from xtests/permissions rename to xtests/outputs/permissions_long_group_header.ansitxt index 6ed9ad9..a5ae84b 100644 --- a/xtests/permissions +++ b/xtests/outputs/permissions_long_group_header.ansitxt @@ -1,4 +1,3 @@ -/testcases/permissions/forbidden-directory: Permission denied (os error 13) Permissions Size User Group Date Modified Name .--------- 0 cassowary cassowary  1 Jan 12:34 000 .--------x 0 cassowary cassowary  1 Jan 12:34 001 diff --git a/xtests/permissions_sudo b/xtests/outputs/permissions_long_group_header_sudo.ansitxt similarity index 97% rename from xtests/permissions_sudo rename to xtests/outputs/permissions_long_group_header_sudo.ansitxt index fb242d6..4e5cbb4 100644 --- a/xtests/permissions_sudo +++ b/xtests/outputs/permissions_long_group_header_sudo.ansitxt @@ -1,4 +1,3 @@ -/testcases/permissions/forbidden-directory: Permission denied (os error 13) Permissions Size User Group Date Modified Name .--------- 0 cassowary cassowary  1 Jan 12:34 000 .--------x 0 cassowary cassowary  1 Jan 12:34 001 diff --git a/xtests/themed_long b/xtests/outputs/permissions_long_themed.ansitxt similarity index 100% rename from xtests/themed_long rename to xtests/outputs/permissions_long_themed.ansitxt diff --git a/xtests/proc_1_root b/xtests/outputs/proc_1_root.ansitxt similarity index 100% rename from xtests/proc_1_root rename to xtests/outputs/proc_1_root.ansitxt diff --git a/xtests/proc_1_root_@ b/xtests/outputs/proc_1_root_xattrs.ansitxt similarity index 100% rename from xtests/proc_1_root_@ rename to xtests/outputs/proc_1_root_xattrs.ansitxt diff --git a/xtests/specials b/xtests/outputs/specials_long.ansitxt similarity index 100% rename from xtests/specials rename to xtests/outputs/specials_long.ansitxt diff --git a/xtests/specials_F b/xtests/outputs/specials_long_classify.ansitxt similarity index 100% rename from xtests/specials_F rename to xtests/outputs/specials_long_classify.ansitxt diff --git a/xtests/specials_sort b/xtests/outputs/specials_oneline_sort_type.ansitxt similarity index 100% rename from xtests/specials_sort rename to xtests/outputs/specials_oneline_sort_type.ansitxt diff --git a/xtests/themed_specials b/xtests/outputs/specials_oneline_themed.ansitxt similarity index 100% rename from xtests/themed_specials rename to xtests/outputs/specials_oneline_themed.ansitxt diff --git a/xtests/run.sh b/xtests/run.sh index 103da5c..83682d1 100755 --- a/xtests/run.sh +++ b/xtests/run.sh @@ -1,8 +1,7 @@ #!/bin/bash -set +xe +trap 'exit' ERR - -# Release mode +# Check for release mode case "$1" in "--release") exa_binary="$HOME/target/release/exa" ;; *) exa_binary="$HOME/target/debug/exa" ;; @@ -14,282 +13,15 @@ if [ ! -f "$exa_binary" ]; then exit 1 fi +echo -e "#!/bin/sh\nexec $exa_binary --colour=always \"\$@\"" > /tmp/exa +chmod +x /tmp/exa +export PATH="/tmp:$PATH" -# The exa command that ends up being run -exa="$exa_binary --colour=always" - -# Directory containing our awkward testcase files -testcases="/testcases" - -# Directory containing existing test results to compare against -results="/vagrant/xtests" - - -# We want to use strict mode here. It’s important that no combination of -# testing flags happens to work by accident! -export EXA_STRICT="1" - -# We also don’t want to see reams and reams of debug output. +# Unset any environment variables +export EXA_STRICT="" export EXA_DEBUG="" - -# And default colours by default export LS_COLORS="" export EXA_COLORS="" - -# Check that no files were created more than a year ago. -# Files not from the current year use a different date format, meaning -# that tests will fail until the VM gets re-provisioned. -# (Ignore the folder that deliberately has dates in the past) -sudo find $testcases -mtime +365 -not -path "*/dates/*" -printf "File %p has not been modified since %TY! Consider re-provisioning; tests will probably fail.\n" - - -# Long view tests -$exa $testcases/files -l | diff -q - $results/files_l || exit 1 -$exa $testcases/files -lh | diff -q - $results/files_lh || exit 1 -$exa $testcases/files -lhb | diff -q - $results/files_lhb || exit 1 -$exa $testcases/files -lhB | diff -q - $results/files_lhb2 || exit 1 -$exa $testcases/attributes/dirs/no-xattrs_empty -lh | diff -q - $results/empty || exit 1 - -$exa --color-scale $testcases/files -l | diff -q - $results/files_l_scale || exit 1 - - -# Grid view tests -COLUMNS=40 $exa $testcases/files | diff -q - $results/files_40 || exit 1 -COLUMNS=80 $exa $testcases/files | diff -q - $results/files_80 || exit 1 -COLUMNS=120 $exa $testcases/files | diff -q - $results/files_120 || exit 1 -COLUMNS=160 $exa $testcases/files | diff -q - $results/files_160 || exit 1 -COLUMNS=200 $exa $testcases/files | diff -q - $results/files_200 || exit 1 - -COLUMNS=100 $exa $testcases/files/* | diff -q - $results/files_star_100 || exit 1 -COLUMNS=150 $exa $testcases/files/* | diff -q - $results/files_star_150 || exit 1 -COLUMNS=200 $exa $testcases/files/* | diff -q - $results/files_star_200 || exit 1 - - -# Long grid view tests -COLUMNS=40 $exa $testcases/files -lG | diff -q - $results/files_lG_40 || exit 1 -COLUMNS=80 $exa $testcases/files -lG | diff -q - $results/files_lG_80 || exit 1 -COLUMNS=120 $exa $testcases/files -lG | diff -q - $results/files_lG_120 || exit 1 -COLUMNS=160 $exa $testcases/files -lG | diff -q - $results/files_lG_160 || exit 1 -COLUMNS=200 $exa $testcases/files -lG | diff -q - $results/files_lG_200 || exit 1 - -COLUMNS=100 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_100 || exit 1 -COLUMNS=150 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_150 || exit 1 -COLUMNS=200 $exa $testcases/files/* -lG | diff -q - $results/files_star_lG_200 || exit 1 - - -# File size tests -$exa $testcases/files -l --binary | diff -q - $results/files_l_binary || exit 1 -$exa $testcases/files -l --bytes | diff -q - $results/files_l_bytes || exit 1 - -EXA_STRICT= $exa $testcases/files -l --bytes --binary | diff -q - $results/files_l_binary || exit 1 -EXA_STRICT= $exa $testcases/files -l --binary --bytes | diff -q - $results/files_l_bytes || exit 1 - - -# Attributes -# (there are many tests, but they’re all done in one go) -$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1 -$exa $testcases/attributes -@T | diff -q - $results/attributes_dir || exit 1 -$exa $testcases/attributes/* -@T | diff -q - $results/attributes_files || exit 1 - - -# UIDs and GIDs -$exa $testcases/passwd -lgh | diff -q - $results/passwd || exit 1 - - -# Permissions, and current users and groups -sudo -u cassowary $exa $testcases/permissions -lghR 2>&1 | diff -q - $results/permissions_sudo || exit 1 - $exa $testcases/permissions -lghR 2>&1 | diff -q - $results/permissions || exit 1 - -# File names -# (Mostly escaping control characters in file names) -COLUMNS=80 $exa $testcases/file-names 2>&1 | diff -q - $results/file_names || exit 1 -COLUMNS=80 $exa $testcases/file-names -x 2>&1 | diff -q - $results/file_names_x || exit 1 -COLUMNS=80 $exa $testcases/file-names -R 2>&1 | diff -q - $results/file_names_R || exit 1 - $exa $testcases/file-names -1 2>&1 | diff -q - $results/file_names_1 || exit 1 - $exa $testcases/file-names -T 2>&1 | diff -q - $results/file_names_T || exit 1 - $exa $testcases/file-names -T@ 2>&1 | diff -q - $results/file_names_T@ || exit 1 - -# At least make sure it handles invalid UTF-8 arguments without crashing -$exa $testcases/file-names/* >/dev/null || exit 1 - - -# Sorting and extension file types -$exa $testcases/file-names-exts -1 2>&1 --sort=name | diff -q - $results/file-names-exts || exit 1 -$exa $testcases/file-names-exts -1 2>&1 --sort=Name | diff -q - $results/file-names-exts-case || exit 1 -$exa $testcases/file-names-exts -1 2>&1 --sort=ext | diff -q - $results/file-names-exts-ext || exit 1 -$exa $testcases/file-names-exts -1 2>&1 --sort=Ext | diff -q - $results/file-names-exts-ext-case || exit 1 - -# Pass multiple input arguments because there aren’t enough of different types -# in one directory already -$exa $testcases/links -1 --sort=type 2>&1 | diff -q - $results/sort-by-type || exit 1 - -# We can’t guarantee inode numbers, but we can at least check that they’re in -# order. The inode column is the leftmost one, so sort works for this. -$exa $testcases/file-names-exts --long --inode --sort=inode | sort --check || exit 1 - - -# Other file types -$exa $testcases/specials -l 2>&1 | diff -q - $results/specials || exit 1 -$exa $testcases/specials -F -l 2>&1 | diff -q - $results/specials_F || exit 1 -$exa $testcases/specials --sort=type -1 2>&1 | diff -q - $results/specials_sort || exit 1 - - -# Ignores -$exa $testcases/file-names-exts/music.* -I "*.OGG" -1 2>&1 | diff -q - $results/ignores_ogg || exit 1 -$exa $testcases/file-names-exts/music.* -I "*.OGG|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1 - - -# Dates and times -$exa $testcases/dates -lh --accessed --sort=accessed 2>&1 | diff -q - $results/dates_accessed || exit 1 -$exa $testcases/dates -lh --sort=modified 2>&1 | diff -q - $results/dates_modified || exit 1 -$exa $testcases/dates -lh --sort=newest 2>&1 | diff -q - $results/dates_modified || exit 1 -$exa $testcases/dates -lh -r --sort=newest 2>&1 | diff -q - $results/dates_deifidom || exit 1 -$exa $testcases/dates -lh --sort=oldest 2>&1 | diff -q - $results/dates_deifidom || exit 1 -$exa $testcases/dates -l --time-style=long-iso 2>&1 | diff -q - $results/dates_long_iso || exit 1 -$exa $testcases/dates -l --time-style=full-iso 2>&1 | diff -q - $results/dates_full_iso || exit 1 -$exa $testcases/dates -l --time-style=iso 2>&1 | diff -q - $results/dates_iso || exit 1 - -# Locales -# These two are used in particular because they have 5-long and 4-long -# month names respectively -env LC_ALL=fr_FR.UTF-8 LANG=fr_FR.UTF-8 $exa $testcases/dates -l | diff -q - $results/dates_fr || exit 1 -env LC_ALL=ja_JP.UTF-8 LANG=ja_JP.UTF-8 $exa $testcases/dates -l | diff -q - $results/dates_jp || exit 1 - - -# Paths and directories -# These directories are created in the VM user’s home directory (the default -# location) when a Cargo build is done. -(cd; mkdir -p target/debug/build - $exa -1d target target/debug target/debug/build | diff -q - $results/dir_paths) || exit 1 - $exa -1d . .. / | diff -q - $results/dirs || exit 1 - - -# Links -COLUMNS=80 $exa $testcases/links 2>&1 | diff -q - $results/links || exit 1 - $exa $testcases/links -1 2>&1 | diff -q - $results/links_1 || exit 1 - $exa $testcases/links -T 2>&1 | diff -q - $results/links_T || exit 1 - $exa $testcases/links -T@ 2>&1 | diff -q - $results/links_T@ || exit 1 - $exa /proc/1/root -T 2>&1 | diff -q - $results/proc_1_root || exit 1 - $exa /proc/1/root -T@ 2>&1 | diff -q - $results/proc_1_root_@ || exit 1 - -# There’ve been bugs where the target file wasn’t printed properly when the -# symlink file was specified on the command-line directly. -$exa $testcases/links/* -1d | diff -q - $results/links_1_files || exit 1 - - -# Colours and terminals -# Just because COLUMNS is present, doesn’t mean output is to a terminal -COLUMNS=80 $exa_binary $testcases/files -l | diff -q - $results/files_l_bw || exit 1 -COLUMNS=80 $exa_binary --colour=always $testcases/files -l | diff -q - $results/files_l || exit 1 -COLUMNS=80 $exa_binary --colour=never $testcases/files -l | diff -q - $results/files_l_bw || exit 1 -COLUMNS=80 $exa_binary --colour=automatic $testcases/files -l | diff -q - $results/files_l_bw || exit 1 - -# Switching colour off -COLUMNS=80 $exa_binary --colour=never $testcases/file-names | diff -q - $results/file_names_bw || exit 1 -COLUMNS=80 $exa_binary --colour=never $testcases/file-names-exts | diff -q - $results/file-names-exts-bw || exit 1 -COLUMNS=80 $exa_binary --colour=never -T $testcases/file-names/links | diff -q - $results/links_bw || exit 1 - - -# Git -$exa $testcases/git -l --git 2>&1 | diff -q - $results/git_1_long || exit 1 -$exa $testcases/git -l 2>&1 | diff -q - $results/git_1_nogit || exit 1 -$exa $testcases/git --recurse -l --git 2>&1 | diff -q - $results/git_1_recurse || exit 1 -$exa $testcases/git --tree -l --git 2>&1 | diff -q - $results/git_1_tree || exit 1 -$exa $testcases/git/moves/thither --tree -l --git 2>&1 | diff -q - $results/git_1_file || exit 1 -$exa $testcases/git/additions -l --git 2>&1 | diff -q - $results/git_1_additions || exit 1 -$exa $testcases/git/edits -l --git 2>&1 | diff -q - $results/git_1_edits || exit 1 -$exa $testcases/git/{additions,edits} -l --git 2>&1 | diff -q - $results/git_1_both || exit 1 - -$exa $testcases/git2 -l --git 2>&1 | diff -q - $results/git_2_long || exit 1 -$exa $testcases/git2 -l 2>&1 | diff -q - $results/git_2_nogit || exit 1 -$exa $testcases/git2 --tree -l --git 2>&1 | diff -q - $results/git_2_tree || exit 1 -$exa $testcases/git2 --recurse -l --git 2>&1 | diff -q - $results/git_2_recurse || exit 1 -$exa $testcases/git2/ignoreds -l --git 2>&1 | diff -q - $results/git_2_ignoreds || exit 1 -$exa $testcases/git2/target -l --git 2>&1 | diff -q - $results/git_2_target || exit 1 -$exa $testcases/git2/deeply/nested/repository -l --git 2>&1 | diff -q - $results/git_2_repository || exit 1 -$exa $testcases/git2/{deeply,ignoreds,target} -l --git 2>&1 | diff -q - $results/git_2_all || exit 1 - -# Regressions test -$exa $testcases/git3 -l --git &>/dev/null || exit 1 - -COLUMNS=150 $exa $testcases/git/**/* $testcases --git --long --grid -d | diff -q - $results/git_1_files || exit 1 - -$exa $testcases/git $testcases/git2 --git --long | diff -q - $results/git_12 || exit 1 - -$exa $testcases/git/additions $testcases/git2/deeply \ - $testcases/git/edits $testcases/git2/deeply/nested --git --long | diff -q - $results/git_1212 || exit 1 - -$exa $testcases/git2/deeply/nested/directory $testcases/git/edits \ - $testcases/git2/target $testcases/git2/deeply $testcases/git --git --long | diff -q - $results/git_21221 || exit 1 - - $exa $testcases/files -l --git | diff -q - $results/files_l || exit 1 # no git status for dirs -COLUMNS=40 $exa $testcases/files -lG --git | diff -q - $results/files_lG_40 || exit 1 # that aren't under git - - -# .gitignore -$exa $testcases/git2 --recurse --long --git-ignore 2>&1 | diff - $results/git_2_ignore_recurse -$exa $testcases/git2 --tree --long --git-ignore 2>&1 | diff - $results/git_2_ignore_tree - - -# Hidden files -COLUMNS=80 $exa $testcases/hiddens 2>&1 | diff -q - $results/hiddens || exit 1 -COLUMNS=80 $exa $testcases/hiddens -a 2>&1 | diff -q - $results/hiddens_a || exit 1 -COLUMNS=80 $exa $testcases/hiddens -aa 2>&1 | diff -q - $results/hiddens_aa || exit 1 - -$exa $testcases/hiddens -l 2>&1 | diff -q - $results/hiddens_l || exit 1 -$exa $testcases/hiddens -l -a 2>&1 | diff -q - $results/hiddens_la || exit 1 -$exa $testcases/hiddens -l -aa 2>&1 | diff -q - $results/hiddens_laa || exit 1 - - -# Themes -LS_COLORS="bd=31:cd=32:pi=34" $exa -1 $testcases/specials 2>&1 | diff -q - $results/themed_specials || exit 1 -EXA_COLORS="bd=31:cd=32:pi=34" $exa -1 $testcases/specials 2>&1 | diff -q - $results/themed_specials || exit 1 - - LS_COLORS="*.deb=1;37:*.tar.*=1;37" $exa -1 $testcases/file-names-exts/compressed.* 2>&1 | diff -q - $results/themed_compresseds || exit 1 -EXA_COLORS="*.deb=1;37:*.tar.*=1;37" $exa -1 $testcases/file-names-exts/compressed.* 2>&1 | diff -q - $results/themed_compresseds || exit 1 -EXA_COLORS="*.deb=1;37" LS_COLORS="*.tar.*=1;37" $exa -1 $testcases/file-names-exts/compressed.* 2>&1 | diff -q - $results/themed_compresseds || exit 1 - - LS_COLORS="reset:*.deb=1;37:*.tar.*=1;37" $exa -1 $testcases/file-names-exts/compressed.* 2>&1 | diff -q - $results/themed_compresseds || exit 1 -EXA_COLORS="reset:*.deb=1;37:*.tar.*=1;37" $exa -1 $testcases/file-names-exts/compressed.* 2>&1 | diff -q - $results/themed_compresseds_r || exit 1 - -EXA_COLORS="or=32:bO=1:cc=35:ln=31:xx=33" $exa -1 $testcases/file-names/links 2>&1 | diff -q - $results/themed_links || exit 1 - -# EXA_COLORS overrides LS_COLORS -LS_COLORS="bd=32:cd=34:pi=31" EXA_COLORS="bd=31:cd=32:pi=34" $exa -1 $testcases/specials 2>&1 | diff -q - $results/themed_specials || exit 1 - -EXA_COLORS="di=38;5;195:fi=38;5;250:xx=38;5;237:ur=38;5;194:uw=38;5;193:ux=38;5;192:gr=38;5;191:gw=38;5;190:gx=38;5;118:tr=38;5;119:tw=38;5;120:tx=38;5;121:su=38;5;51:sf=38;5;50:sn=38;5;49:un=38;5;46:da=38;5;47:ex=38;5;48" \ - $exa --long $testcases/permissions 2>&1 | diff -q - $results/themed_long || exit 1 - -EXA_COLORS="reset" $exa $testcases/file-names-exts -1 2>&1 | diff -q - $results/themed_un || exit 1 - -# Errors -$exa --binary 2>&1 | diff -q - $results/error_useless || exit 1 -$exa --ternary 2>&1 | diff -q - $results/error_long || exit 1 -$exa -4 2>&1 | diff -q - $results/error_short || exit 1 -$exa --time 2>&1 | diff -q - $results/error_value || exit 1 -$exa --long=time 2>&1 | diff -q - $results/error_overvalued || exit 1 -$exa -l --long 2>&1 | diff -q - $results/error_duplicate || exit 1 -$exa -ll 2>&1 | diff -q - $results/error_twice || exit 1 -$exa -l --time-style=24 2>&1 | diff -q - $results/error_setting || exit 1 - -# Error suggestions -$exa -ltr 2>&1 | diff -q - $results/error_ltr || exit 1 -$exa -lt 2>&1 | diff -q - $results/error_lt || exit 1 - - -# Debug mode -# What gets logged keeps changing, so instead of checking for an exact output, -# list an empty directory and fail if nothing gets printed. -DEBUG_OUT=$(EXA_DEBUG="1" $exa $testcases/attributes/dirs/no-xattrs_empty -lh 2>&1) -if [ -z "$DEBUG_OUT" ]; then - echo "Debug test produced no output" - exit 1 -fi - - -# And finally... -$exa --help | diff -q - $results/help || exit 1 - - -echo "All the tests passed!" +# Run the tests +exec specsheet $(dirname "$0")/*.toml -O cmd.shell=bash diff --git a/xtests/sorting.toml b/xtests/sorting.toml new file mode 100644 index 0000000..f25d798 --- /dev/null +++ b/xtests/sorting.toml @@ -0,0 +1,138 @@ +# sorting by name + +[[cmd]] +name = "‘exa -1 --sort=name’ sorts by file name" +shell = "exa -1 --sort=name /testcases/file-names-exts" +stdout = { file = "outputs/exts_oneline_sort_name.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + +[[cmd]] +name = "‘exa -1 --sort=Name’ sorts by file name (case-sensitively)" +shell = "exa -1 --sort=Name /testcases/file-names-exts" +stdout = { file = "outputs/exts_oneline_sort_namecase.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + + +# sorting by file extension + +[[cmd]] +name = "‘exa -1 --sort=ext’ sorts by file extension" +shell = "exa -1 --sort=ext /testcases/file-names-exts" +stdout = { file = "outputs/exts_oneline_sort_ext.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + +[[cmd]] +name = "‘exa -1 --sort=Ext’ sorts by file extension (case-sensitively)" +shell = "exa -1 --sort=Ext /testcases/file-names-exts" +stdout = { file = "outputs/exts_oneline_sort_extcase.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + + +# sorting by kind + +[[cmd]] +name = "‘exa -1 --sort=type’ sorts by file kind (files and symlinks)" +shell = "exa -1 --sort=type /testcases/links" +stdout = { file = "outputs/links_oneline_sort_type.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + +[[cmd]] +name = "‘exa -1 --sort=type’ sorts by file kind (special files)" +shell = "exa -1 --sort=type /testcases/specials" +stdout = { file = "outputs/specials_oneline_sort_type.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort' ] + + +# sorting by inode + +# We can’t guarantee inode numbers, but we can at least check that they’re in +# order. The inode column is the leftmost one, so sort works for this. +[[cmd]] +name = "‘exa -l --inode --sort=inode’ sorts by file inode" +shell = "exa -l --inode --sort=inode /testcases/file-names-exts | sort --check" +stdout = { empty = true } +stderr = { empty = true } +status = 0 +tags = [ 'long', 'inode', 'sort' ] + + +# sorting by modified date + +[[cmd]] +name = "‘exa -1 --sort=modified’ sorts most recently modified at the bottom" +shell = "exa -1 --sort=modified /testcases/dates" +stdout = { string = "pear\npeach\nplum" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates' ] + +[[cmd]] +name = "‘exa -1 --sort=modified -r’ sorts most recently modified at the top" +shell = "exa -1 --sort=modified -r /testcases/dates" +stdout = { string = "plum\npeach\npear" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates', 'reverse' ] + +[[cmd]] +name = "‘exa -1 --sort=newest’ sorts most recently modified at the bottom" +shell = "exa -1 --sort=newest /testcases/dates" +stdout = { string = "pear\npeach\nplum" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates' ] + +[[cmd]] +name = "‘exa -1 --sort=newest -r’ sorts most recently modified at the top" +shell = "exa -1 --sort=newest -r /testcases/dates" +stdout = { string = "plum\npeach\npear" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates', 'reverse' ] + +[[cmd]] +name = "‘exa -1 --sort=oldest’ sorts most recently modified at the top" +shell = "exa -1 --sort=oldest /testcases/dates" +stdout = { string = "plum\npeach\npear" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates' ] + +[[cmd]] +name = "‘exa -1 --sort=oldest -r’ sorts most recently modified at the bottom" +shell = "exa -1 --sort=oldest -r /testcases/dates" +stdout = { string = "pear\npeach\nplum" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates', 'reverse' ] + + +# sorting by other date fields + +[[cmd]] +name = "‘exa -1 --sort=created’ sorts by created date" +shell = "exa -1 --sort=created /testcases/dates" +stdout = { string = "peach\nplum\npear" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates' ] + +[[cmd]] +name = "‘exa -1 --sort=accessed’ sorts by accessed date" +shell = "exa -1 --sort=accessed /testcases/dates" +stdout = { string = "plum\npear\npeach" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'sort', 'dates' ] diff --git a/xtests/themes.toml b/xtests/themes.toml new file mode 100644 index 0000000..34a8c31 --- /dev/null +++ b/xtests/themes.toml @@ -0,0 +1,112 @@ +# links + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ to theme symlinks" +shell = "exa -1 /testcases/file-names/links" +environment = { EXA_COLORS = "or=32:bO=1:cc=35:ln=31:xx=33" } +stdout = { file = "outputs/links_oneline_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + + +# special files + +[[cmd]] +name = "exa uses ‘LS_COLORS’ to theme pipes and devices" +shell = "exa -1 /testcases/specials" +environment = { LS_COLORS = "bd=31:cd=32:pi=34" } +stdout = { file = "outputs/specials_oneline_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ to theme pipes and devices" +shell = "exa -1 /testcases/specials" +environment = { EXA_COLORS = "bd=31:cd=32:pi=34" } +stdout = { file = "outputs/specials_oneline_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa prefers ‘EXA_COLORS’ over ‘LS_COLORS’ to theme pipes and devices" +shell = "exa -1 /testcases/specials" +environment = { LS_COLORS = "bd=32:cd=34:pi=31", EXA_COLORS = "bd=31:cd=32:pi=34" } +stdout = { file = "outputs/specials_oneline_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + + +# extensions + +[[cmd]] +name = "exa uses ‘LS_COLORS’ to theme files based on their extension" +shell = "exa -1 /testcases/file-names-exts/compressed.*" +environment = { LS_COLORS = "*.deb=1;37:*.tar.*=1;37" } +stdout = { file = "outputs/exts_compressed_paths_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ to theme files based on their extension" +shell = "exa -1 /testcases/file-names-exts/compressed.*" +environment = { LS_COLORS = "*.deb=1;37:*.tar.*=1;37" } +stdout = { file = "outputs/exts_compressed_paths_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa uses both ‘LS_COLORS’ and ‘EXA_COLORS’ to theme files based on their extension" +shell = "exa -1 /testcases/file-names-exts/compressed.*" +environment = { EXA_COLORS = "*.deb=1;37", LS_COLORS="*.tar.*=1;37" } +stdout = { file = "outputs/exts_compressed_paths_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ with only ‘reset’ to not theme any files" +shell = "exa -1 /testcases/file-names-exts" +environment = { EXA_COLORS = "reset" } +stdout = { file = "outputs/exts_themed_reset.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + + +# extensions with resets + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ with ‘reset:’ to theme files based on their extension, and no others" +shell = "exa -1 /testcases/file-names-exts/compressed.*" +environment = { EXA_COLORS = "reset:*.deb=1;37:*.tar.*=1;37" } +stdout = { file = "outputs/exts_compressed_paths_themed_reset.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + +[[cmd]] +name = "exa ignores ‘LS_COLORS’ with ‘reset:’" +shell = "exa -1 /testcases/file-names-exts/compressed.*" +environment = { LS_COLORS = "reset:*.deb=1;37:*.tar.*=1;37" } +stdout = { file = "outputs/exts_compressed_paths_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] + + +# details view + +[[cmd]] +name = "exa uses ‘EXA_COLORS’ to theme metadata" +shell = "exa --long /testcases/permissions" +environment = { EXA_COLORS = "di=38;5;195:fi=38;5;250:xx=38;5;237:ur=38;5;194:uw=38;5;193:ux=38;5;192:gr=38;5;191:gw=38;5;190:gx=38;5;118:tr=38;5;119:tw=38;5;120:tx=38;5;121:su=38;5;51:sf=38;5;50:sn=38;5;49:un=38;5;46:da=38;5;47:ex=38;5;48" } +stdout = { file = "outputs/permissions_long_themed.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'oneline', 'themes' ] diff --git a/xtests/tree-view.toml b/xtests/tree-view.toml new file mode 100644 index 0000000..095483a --- /dev/null +++ b/xtests/tree-view.toml @@ -0,0 +1,31 @@ +# file name tests + +[[cmd]] +name = "‘exa -T’ produces a tree of file names" +shell = "exa -T /testcases/file-names" +stdout = { file = "outputs/names_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'tree' ] + + +# symlinks tests + +[[cmd]] +name = "‘exa -T’ lists the destination of symlinks" +shell = "exa -T /testcases/links" +stdout = { file = "outputs/links_tree.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'tree' ] + + +# permission errors tests + +[[cmd]] +name = "‘exa -T’ displays an inaccessible directory" +shell = "exa -T /proc/1/root" +stdout = { file = "outputs/proc_1_root.ansitxt" } +stderr = { empty = true } +status = 0 +tags = [ 'tree' ]