Commit Graph

128 Commits

Author SHA1 Message Date
Benjamin Sago
b1c49341c0 Add tests for common command-line errors
Specifically, making sure that they start with "exa", which is something that's been bugging me recently.
2021-04-12 21:55:22 +01:00
Benjamin Sago
550f2d29c2 Add context to all option number parse errors
Fixes GH-839.
2021-04-12 21:42:45 +01:00
Benjamin Sago
31043462af Improve help text for -d flag
Fixes GH-202.
2021-04-11 23:43:36 +01:00
Benjamin Sago
d19d66d57a Fix device IDs test so it works every time
It inadvertently contained the machine build time, which meant it stopped working once the Vagrant machine was rebuild.
2021-04-11 23:34:14 +01:00
Benjamin Sago
051a46c643
Merge pull request #842 from ariasuni/dont-aggregate-git-ignored-status2
Fix deducing git ignored state for files too, not only directories
2021-04-11 20:33:56 +01:00
ariasuni
bfd2644869 Add xtests for new git ignored status deducing logic 2021-04-10 01:42:02 +02:00
Benjamin Sago
f6e66d982d Add tests for device IDs in file size column 2021-04-09 23:59:54 +01:00
Benjamin Sago
e86f2b938b
Merge pull request #837 from ariasuni/fix-month-name-not-translated
Fix month name not following locale when date is in current year
2021-04-09 23:11:28 +01:00
ariasuni
f673e018b5 Add a test checking that date of the current year follows locale 2021-04-09 18:46:10 +02:00
ariasuni
beaf561086 Add xtests for EXA_GRID_ROWS 2021-04-09 17:48:00 +02:00
ariasuni
a0457f9c87 Fix misleading name of some test files 2021-04-09 17:48:00 +02:00
ariasuni
050931e48f Fix a typo in test descriptions 2021-04-09 17:48:00 +02:00
Benjamin Sago
8c34b46a22 Version output changes
• Bring what's shown in the version string in line with my other projects (URL, description, git hash and date for release-mode non-final builds only, potential for colours in the future)
• Show +git or -git depending on feature status
• Tests for the above, and for checking that the command-line flag is warned about
2021-04-03 17:41:48 +01:00
Benjamin Sago
701a2e60e5 Add 'exa: ' before all command-line errors 2021-04-01 11:25:50 +01:00
Benjamin Sago
622904d07c Fix integration tests after merged PRs
• The spaces between icons and filenames are now coloured too
• Some icons are different
• File sizes are now more accurate
• New help text, which needed a newline at the end
2021-04-01 10:19:34 +01:00
Benjamin Sago
5d13a65e4f Justfile improvements 2021-04-01 09:39:03 +01:00
Benjamin Sago
96e9307b99
Merge pull request #790 from ariasuni/fix-too-many-headers-in-grid-details
Don’t produce extra column sometimes with long grid + header
2021-03-30 14:37:52 +01:00
Benjamin Sago
da171c405f Fix argument sorting in test outputs
See GH-756.
2021-03-29 23:02:35 +01:00
whonore
cfa00bf4b2 Fix new tests 2021-01-15 16:45:54 -05:00
whonore
c8ed69368e Add tests 2021-01-14 10:01:27 -05:00
ariasuni
0f414cf0b9 Don’t produce extra column sometimes with long grid + header
The number of necessary columns was computed by producing a grid in different sizes and see if all columns were used. However, if there was two files and we tried to fit them in a 3-column grid, it would produces three headers and all three columns would be used; when trying a 4-column grid, the two supplementary headers would fill the third column and the fourth would be empty; so 3 columns would be used.

Now, when the grid fits into the terminal and the number of columns is exactly the number of files to display, it returns immediately instead of trying bigger grids.

Fixes GH-436.
2021-01-12 20:18:19 +01:00
ariasuni
73e43c0700 Fix Vagrantfile and extended tests 2021-01-11 18:55:06 +01:00
Benjamin Sago
51be9f4c43 Introduce EXA_ICON_SPACING environment variable
This commit remove the extra space that was added between icons and file names in commit 128fadd, and adds an option to put them back.

Re-fixes GH-619 and fixes GH-541.
2020-10-24 19:41:07 +01:00
Benjamin Sago
c83359225b Fix xtests for previous two commits 2020-10-24 18:43:59 +01:00
Benjamin Sago
f1e3e7c7ff Move icon generation into file name module
This commit makes adding icons to file names something that the file name renderer does, rather than something that each individual view does. This is now possible thanks to the previous commit a1869f2, which moved the option to do this into the same module. The repeated code has been removed.

It happens to fix a bug where the width of each column was being incorrectly calculated for the grid-details view, making lines slightly too long for the terminal because the icon wasn't being taken into account.
2020-10-24 18:03:36 +01:00
Benjamin Sago
800c73ff24 Add icons xtests 2020-10-23 23:49:10 +01:00
Benjamin Sago
06c899cac0 More git-ignore xtests
The new tests make sure that the git-ignored files are skipped in every view.
2020-10-17 21:59:15 +01:00
Benjamin Sago
d8b21a33b5 More date-related xtests
• Displaying accessed and modified dates
• Displaying dates in the distant past and far future (#557)
2020-10-17 21:26:24 +01:00
Benjamin Sago
ef7bb43dbb Fix xtests bug where git3 file date kept changing 2020-10-17 21:25:49 +01:00
Benjamin Sago
61c5df7c11 Use Specsheet for the extended tests
This commit changes the way the extended test suite is run.

Previously, there was a folder full of outputs, and a script that ran exa repeatedly to check the outputs match. This script was hacked-together, with many problems:

• It stops at the first failure, so if one test fails, you have no idea how many actually failed.
• It also didn't actually show you the diff if one was different, it just checked it.
• It combined stdout and stderr, and didn't test the exit status of exa.
• All the output file names were just whatever I felt like calling the file at the time.
• There is no way to only run a few of the tests — you have to run the whole thing each time.
• There's no feel-good overall view where you see how many tests are passing.

I started writing Specsheet to solve this problem (amongst other problems), and now, three and a half years later, it's finally ready for prime time.

The tests are now defined as data rather than as a script. The outputs have a consistent naming convention (directory_flags.ansitxt), and they check stdout, stderr, and exit status separately. Specsheet also lets simple outputs (empty, non-empty, or one-line error messages) can be written inline rather than needing to be in files.

So even though this pretty much runs the same tests as the run.sh script did, the tests are now more organised, making it easy to see where tests are missing and functionality is not being tested.
2020-10-17 21:12:18 +01:00
Benjamin Sago
86de17b788 Help text changes
This changes the --help text, and gets rid of the special behaviour for --help --long, which I thought was a really good idea at the time, but now I just think it's inconsistent and unexpected behaviour. --help should return the same help, no matter what other arguments you have typed.

Other things:
• Put --help and --version in a section
• Capitalisation consistency
• Alignment
• Move the --octal-permissions line up a bit
• Simplify the printing implementation (HelpString is now a unit struct)

This _finally_ makes all the extended tests pass.
2020-10-16 23:53:42 +01:00
Benjamin Sago
12c562c93f Fix integration test suite 2 2020-01-19 10:09:07 +00:00
Benjamin Sago
efad1c9e4e Fix integration test suite
• Fix script problem with shell operator precedence with Git repo symlinks
• Fix test failure with --long --help
2020-01-19 00:50:08 +00:00
Benjamin Sago
64bd1b9a55
Merge pull request #584 from msehnout/fix-panic-on-broken-symlink
fix panic on broken symlink in git repository
2020-01-19 00:48:07 +00:00
Benjamin Sago
1f167dda41
Merge pull request #577 from 0rvar/feature/suppress-columns
Add support for suppressing table columns
2020-01-19 00:41:27 +00:00
Orvar Segerström
250104c9da Add new suppress flags to --help 2019-12-23 12:08:03 +01:00
Martin Sehnoutka
a7a8e99cf3 fix panic on broken symlink in git repository
The issue including reproducer is described here:
https://github.com/ogham/exa/issues/526
This commit includes proposed change as well as integration test.
2019-09-15 16:56:58 +02:00
Laurent Arnoud
3247de3cbb
Fix vagrant integration tests
* For dates need the LC_ALL env
* Missing new option --icons on help output
2019-08-05 22:48:58 +02:00
Benjamin Sago
9e1200f9b7 Fix failing tests 2019-07-15 03:37:05 +01:00
Benjamin Sago
7dada93c3e Refresh extended tests
It’s clear that these hadn’t actually been run for a while, and after installing Vagrant again I had to clear out the cobwebs. Necessary changes include:

• Rust is installed differently
• Git-ignored files are now marked
• The help text changed
• Listing a directory symlink shows its contents, requiring a change to the way a directory-symlink test gets run
2019-07-13 20:15:44 +01:00
Benjamin Sago
94a00fa17c Fix debug test in Vagrantfile
Ever since env_logger started supporting colours, it doesn’t seem worth it to keep track of what is and isn’t in the log output. So just test that it doesn’t print nothing and call it a day.
2018-09-26 21:16:33 +01:00
Benjamin Sago
59d9e90f20 Replace “mi” colour with “bO” overlay
Fixes #288, but more-or-less as a side-effect.

The “mi” key in LS_COLORS was meant to be used for a missing link path, but it wasn’t really used like that. There was also a bug where control characters in a broken symlink’s path were assumed to be underlined, because that’s what happened in the default colour scheme, but this assumption doesn’t hold when colours were disabled.

The solution to these was not to introduce another configurable colour code, but to start using _overlays_ to alter a bunch of colours at once. The “mi” code will have to be added back later.
2017-10-08 17:08:07 +01:00
Benjamin Sago
173e9b2345 Move the packaging script into its own file
Having it all echo-ed into the file like that made it hard to read *and* hard to maintain. My initial aversion to it was that I didn’t want there to be an executable script in the main repository that only worked when you were in the VM, because people would just run it anyway. But this can be avoided by leaving it non-executable, and having a command in the VM that runs it instead.
2017-10-01 09:48:20 +02:00
Benjamin Sago
827aa8bfc3 Ignore files matched in .gitignore
This doesn’t *completely* work: it seems to have trouble with ignored paths beginning with slashes, possibly amongst others. Also, .gitignore scanning could be made more efficient.
2017-09-30 09:17:29 +02:00
Benjamin Sago
07443e87ba Add a --git-ignore option that doesn’t do anything
!!
2017-09-30 09:17:28 +02:00
Benjamin Sago
2b099d8ba0 Fix up tests to have nested ignored files 2017-09-30 09:17:28 +02:00
Benjamin Sago
c475cccce4 Flip the new/old order, and add suggestion for -lt
I changed my mind about which way round sorting by “newest” or by “oldest” should actually go. If you’re listing a large directory, you see the last lines of the output first, so these files should be the ones with the largest whatever the sort field is. It’s about sorting *last*, not sorting *first*. Sorting by size wouldn’t say “sorts smallest files first”, it would say “sorts largest files last”. Right?

Also, add a new suggestion that warns against “ls -lt”.
2017-09-14 09:18:17 +01:00
Benjamin Sago
a8bf990674 Tie value suggestions to their arguments
This commit changes the definition of Arg so that it knows about which values it can accept, and can display them in the help text. They were already being shown in the help text, but they were passed in separately, so one argument could show two different sets of options if it wanted. Now, the argument itself knows whether there are suggestions, so it doesn’t have to be passed in separately.

This means we can use it for other things, including listing choices when an option is missed out, without having to repeat the list.

With Misfire::BadArgument now only having two fields, it’s not worth using a constructor function anymore.
2017-09-14 01:22:37 +01:00
Benjamin Sago
43bbf00478 Show a warning when running ‘exa -ltr’
Raised in #243 and #284. exa isn’t able to override the -t option like this, so the least it can do is detect that case (which is going to be an error case anyway) and show a suggestion.
2017-09-13 23:47:19 +01:00
Benjamin Sago
0fefc78cbb Add more modified date aliases
I don’t really see the modified date as the *modified* date, rather just the *date* field, because it’s the date field I refer to like 99.9% of the time. So now it has aliases to match.

Also are included are aliases for the reverse order, because I’d rather write “new” than “the reverse of old”.
2017-09-13 23:26:06 +01:00