>What no one has bothered to do is create a high level framework for
testing completion scripts.
Note that this probably isn't as much work as it sounds. Our tests
currently depend on a driver-script (tests/test.fish) that just runs ".in"
fish-scripts and compares their output to the expected output stored in
files named .out and .err, by redirecting it and calling `diff` on it.
For tests, we would need to have a way to specify that the diffing should
be skipped, but this would be possible via e.g. returning a certain status
(I suggest 127, which fish uses when a command wasn't found).
>Keep in mind that unit tests need to be hermetic. So it isn't enough to
only test the completions for a command if the command is available. You
also need to be able to control what the command emits since it can't
depend on the state of the system the test is running on.
And that's the much bigger problem! For e.g. `git`, it would mean shipping
a git repository (or creating it inside a script) that includes at least a
few commits/branches/tags.
For other commands it would be much trickier. E.g. for `mount` it would
only be possible by full-on faking the output (e.g. by creating a `mount`
function), but at that point the question is how much you are testing,
since the most interesting case is a mount implementation that behaves
differently.
Anyway, it might be worth it to introduce at least a few completion tests
for the more interesting and testable scripts. But "100% coverage" seems to
be of little value.
----
>That is this issue: https://github.com/fish-shell/fish-shell/issues/112.
Which we think we have a fix for but haven't merged yet because we didn't
want to include it in the 2.6.0 release we're just about to make due to
insufficient testing.
Yes. To expand, the issue is that fish will expand files when it can't get
any completions otherwise (because the script doesn't return anything).
That might sometimes be preferable, but in my experience when I use
"--no-files" that's because filenames don't make sense in that context, not
just because I'd like other stuff to take precedence.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users