Commit Graph

36 Commits

Author SHA1 Message Date
Benjamin Sago
2d1f462bfa Switch to the new options parser
This commit removes the dependency on the ‘getopts’ crate entirely, and re-writes all its uses to use the new options parser instead.

As expected there are casualties galore:

- We now need to collect the options into a vector at the start, so we can use references to them, knowing they’ll be stored *somewhere*.
- Because OsString isn’t Display, its Debug impl gets used instead. (This is hopefully temporary)
- Options that take values (such as ‘sort’ or ‘time-style’) now parse those values with ‘to_string_lossy’. The ‘lossy’ part means “I’m at a loss for what to do here”
- Error messages got a lot worse, but “--tree --all --all” is now a special case of error rather than just another Misfire::Useless.
- Some tests had to be re-written to deal with the fact that the parser works with references.
- ParseError loses its lifetime and owns its contents, to avoid having to attach <'a> to Misfire.
- The parser now takes an iterator instead of a slice.
- OsStrings can’t be ‘match’ patterns, so the code devolves to using long Eq chains instead.
- Make a change to the xtest that assumed an input argument with invalid UTF-8 in was always an error to stderr, when that now in fact works!
- Fix a bug in Vagrant where ‘exa’ and ‘rexa’ didn’t properly escape filenames with spaces in.
2017-07-26 17:48:18 +01:00
Benjamin Sago
5bdf6304bb Fix bug where accessed times were wrong!
It used the mtime, rather than the atime. Copy and paste error. Whoops!
2017-07-05 22:07:03 +01:00
Benjamin Sago
882ac489ce Much more thorough xattr testing
It now tests a lot more combinations of xattrs on files, as well as xattrs and files and errors as the children of directories.

The recent code changes have touched the part where directories’ xattrs and children are displayed at the same tree level, and there weren’t enough tests for this.
2017-07-04 17:42:16 +01:00
Benjamin Sago
5a2ffd3fbe Generate files with certain timestamps
This is going to be used to test time formatting.

Casualty here is that the “have you not ran the provisioning script in a year?” checker complained about there being files more than a year old, so that now has to ignore the times directory.
2017-07-03 08:46:38 +01:00
Benjamin Sago
9d74091195 Upcase some of the extension testcases
These are going to be used for sort testing. Unfortunately, three existing tests that were using the lowercase versions had to be changed.
2017-06-29 13:57:31 +01:00
Benjamin Sago
dd8bff083f Override the names of . and ..
There was a problem when displaying . and .. in directory listings: their names would normalise to actual names! So instead of literally seeing `.`, you’d see the current directory’s name, inserted in sort order into the list of results. Obviously this is not what we want.

In unrelated news, putting `.` and `..` into the list of paths read from a directory just takes up more heap space for something that’s basically constant.

We can solve both these problems at once by moving the DotFilter to the files iterator in Dir, rather than at the Dir’s creation. Having the iterator know whether it should display `.` and `..` means it can emit those files first, and because it knows what those files really represent, it can override their file names to actually be those sequences of dots.

This is not a perfect solution: the main casualty is that a File can now be constructed with a name, some metadata, both, or neither. This is currently handled with a bunch of Options, and returns IOResult even without doing any IO operations.

But at least all the tests pass!
2017-06-28 18:41:31 +01:00
Benjamin Sago
c4447e35b6 xtests for higher order bits
Finally, re-do the permissions extended tests to include the setuid, setgid, and sticky bits, and rename the last two existing ones to match the others (files with the same names as their permissions).
2017-05-30 15:32:11 +01:00
Benjamin Sago
e10c4b3eb9 Add xtests for existing Git implementation 2017-05-17 20:35:05 +01:00
Benjamin Sago
d2b1499fb1 Add thing for installing cargo-kcov 2017-05-07 20:25:53 +01:00
Benjamin Sago
ad85f3d023 Bash completions 2017-05-06 21:56:40 +01:00
Benjamin Sago
956c5b7181 Rename dexa to just exa 2017-05-06 20:52:43 +01:00
Benjamin Sago
daaadece97 Remember to pass arguments in dexa and rexa 2017-05-06 20:50:47 +01:00
Benjamin Sago
cffbd8d6b1 Zsh completions 2017-05-06 20:50:24 +01:00
Benjamin Sago
3c7800c124 Fish completions 2017-05-06 20:34:59 +01:00
Benjamin Sago
32ab6a5823 Convert the aliases to actual files 2017-05-06 19:38:34 +01:00
Benjamin Sago
b5bd76b548 Give everybody dexa and rexa aliases
Also, make it so the same line doesn’t get added to the .bashrc every time provisioning is run.
2017-05-06 19:14:25 +01:00
Benjamin Sago
558004b6ac Remove openssl build-time dependencies 2017-05-06 14:06:27 +01:00
Benjamin Sago
f51f5fe202 Also escape characters in broken symlinks 2017-05-02 08:46:43 +01:00
Benjamin Sago
56d4d4c156 Also escape characters in links and headings
Doing this meant that the escaping functionality got used in three places, so it was extracted into a generalised function in its own module.

This is slighly slower for the case where escaped characters are displayed in the same colour as the displayable characters, which happens when listing a directory’s name when recursing. Optimise this, yeah?
2017-05-01 21:54:53 +01:00
Benjamin Sago
56f859dd36 Add some awkward file name testcases 2017-05-01 12:22:57 +01:00
Benjamin Sago
6b008a6177 Add tests for relative symlinks 2017-04-30 11:58:29 +01:00
Benjamin Sago
58b6d3e50c Make the Vagrant provisioning process quieter 2017-04-30 11:06:52 +01:00
Kevin Ballard
e73eb2dc1a Fix Vagrantfile 2017-04-29 14:53:47 -07:00
Benjamin Sago
456fa287d2 Tests for classify and special file types 2017-04-29 09:21:31 +01:00
Benjamin Sago
eacbf55594 Start adding some special file testcases 2017-04-28 23:24:19 +01:00
Benjamin Sago
bd5095d0d0 Rename file-types tests to file-names-exts
This name more accurately reflects which code is being tested (things like .png and Makefile, rather than pipes and sockets), freeing up file-types for *actual* file types to be tested.
2017-04-28 20:07:31 +01:00
Benjamin Sago
22be5b047f Switch to an Ubuntu Vagrant image
The non-contrib Debian one doesn’t come with guest additions, meaning it used rsync instead of Virtualbox shared folders to sync files, meaning edits made in the VM didn’t get propogated back to the host, meaning I got very confused for a while.

Thanks to the parent commit, this shouldn’t be an issue at all: the default user name, which is now “ubuntu” instead of “vagrant” is specified in a lot fewer places, making it much easier to change.
2017-04-28 19:36:42 +01:00
Benjamin Sago
ef18f9ca91 Protect xtests against different default users
The Vagrant tests assumed that there’d be a user called “vagrant” that would run the tests and create the files by default. Files would be owned by vagrant:vagrant by default, and this worked, until it came time to change that username. The naïve method was a search-and-replace, but this caused problems when the new user’s name wasn’t exactly the same length as the previous one.

So to fix this, we now have our own user, named after the first animal I thought of, that makes the files’ owners and groups independent of the default user of whichever VM image the xtests are running on.

Another place where it was hard-coded was the home directory, which was “/home/vagrant”, where the awkward testcases live. That last one has been changed to just “/testcases”, which has no mention of the user in it.
2017-04-28 19:34:23 +01:00
Benjamin Sago
b885b34aa6 Protect xtests against the passage of time
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)
2017-04-28 19:26:57 +01:00
Benjamin Sago
23ab19eb20 Merge pull request #147 from spk/use-official-jessie64
Use official vagrant jessie64
2017-04-02 02:33:39 +01:00
Laurent Arnoud
3fa3ae1595
Install pkg-config for openssl-sys 2017-04-01 00:08:41 +02:00
Laurent Arnoud
1447cf53bf
Use official vagrant jessie64 2017-02-26 13:31:43 +01:00
Ben S
ba366fc855 Add some symlink testcases 2016-10-29 19:58:34 +01:00
Ben S
36d9b6844e Add .tgz to the compressed file extensions
Fixes #129
2016-10-29 19:28:41 +01:00
Ben S
9589496aac Write some file-type integration tests 2016-10-29 19:28:20 +01:00
Benjamin Sago
54067bf765 Replace the testcases script with a Vagrant VM
See the README section for more details. Basically, with this way, we can store a bunch of existing valid exa outputs, change a VM's environment to match our values, then check that exa still works by comparing outputs.
2016-10-07 19:31:03 +01:00