mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-04 20:07:53 +00:00
b885b34aa6
There was a problem with the Vagrant tests where the year 2016 was hard-coded in as the modified date. This had to be done to make the --long tests use the correct date format, which varies depending on whether the timestamp is in the current year. Unfortunately, time progresses [citation needed], and what was once 2016 is now 2017, so the date format changed and the tests broke. Because the Vagrantfile is just a Ruby script, we can look up the current year at runtime and use that instead. There’s also a check added to the test runner that makes sure none of the files are more than 365 days old, because if any are, then it’s time to update the timestamps (or it’s the last day of a leap year)
68 lines
2.7 KiB
Bash
Executable File
68 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set +xe
|
|
|
|
|
|
# The exa binary we want to run
|
|
exa="$HOME/target/debug/exa --colour=always"
|
|
|
|
# Directory containing our awkward testcase files
|
|
testcases=~/testcases
|
|
|
|
# Directory containing existing test results to compare against
|
|
results=/vagrant/xtests
|
|
|
|
|
|
# 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.
|
|
sudo find $testcases -mtime +365 -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/empty-with-attribute -lh | diff -q - $results/empty || 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
|
|
|
|
# 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
|
|
|
|
# Attributes
|
|
$exa $testcases/attributes -l@T | diff -q - $results/attributes || exit 1
|
|
|
|
# UIDs and GIDs
|
|
$exa $testcases/passwd -lgh | diff -q - $results/passwd || exit 1
|
|
|
|
# Permissions
|
|
$exa $testcases/permissions -lghR 2>&1 | diff -q - $results/permissions || exit 1
|
|
|
|
# File types
|
|
$exa $testcases/file-types -1 2>&1 | diff -q - $results/file-types || exit 1
|
|
|
|
# Ignores
|
|
$exa $testcases/file-types/music.* -I "*.ogg" -1 2>&1 | diff -q - $results/ignores_ogg || exit 1
|
|
$exa $testcases/file-types/music.* -I "*.ogg|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1
|
|
|
|
# Links
|
|
$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
|
|
|
|
COLUMNS=80 $exa $testcases/links 2>&1 | diff -q - $results/links || exit 1
|
|
|
|
$exa /proc/1/root -T 2>&1 | diff -q - $results/proc_1_root || exit 1
|
|
|
|
|
|
echo "All the tests passed!"
|