Commit graph

176 commits

Author SHA1 Message Date
Fabian Homborg
bf7629462a Port some small tests to littlecheck 2020-02-08 10:38:11 +01:00
Fabian Homborg
8bd97d087d Port set test to littlecheck
Just add it to set.fish. There may be some duplicated ones here, but
that's for another time.
2020-02-08 09:58:27 +01:00
Fabian Homborg
0ddf04b637 Port contains_opt test to littlecheck
And make it one file.
2020-02-08 09:51:52 +01:00
Fabian Homborg
7c2d7387d0 Port complete_directories test to littlecheck 2020-02-08 09:48:41 +01:00
Fabian Homborg
2fa8ae161a Port jobs test to littlecheck 2020-02-08 09:47:14 +01:00
Fabian Homborg
0fab1ce8b4 Port locale test to littlecheck 2020-02-08 09:38:23 +01:00
Fabian Homborg
f8af262af7 Port some smaller tests to littlecheck 2020-02-08 09:31:49 +01:00
Fabian Homborg
eaf84c553d Port line-continuation test to littlecheck 2020-02-08 09:31:49 +01:00
Fabian Homborg
e40441f901 Port history tests to littlecheck 2020-02-07 20:53:20 +01:00
Fabian Homborg
15d2797ec1 Port pipestatus test to littlecheck 2020-02-07 20:49:42 +01:00
Fabian Homborg
fc884e9cf4 Port function.in test to littlecheck 2020-02-07 20:41:01 +01:00
Fabian Homborg
921fce3a51 math: Complain about unknown *function*, not *variable*
We removed variables from tinyexpr, so we shouldn't use that error.
2020-02-07 17:43:22 +01:00
ridiculousfish
bd06a9aa6c Retain leading spaces in non-expanding braces
This makes two changes:

1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was
to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But
we later strip these off anyways, so there is no apparent benefit. If we
are not doing brace expansion, this prevented emitting whitespace at the
beginning or end of an item, leading to #6564.

2. When performing brace expansion, only stomp the space character with
`BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in
came from a newline or tab literal, then we would have effectively
replaced a newline or tab with a space, so this is important for #6564 as
well. Moreover, it is not easy to place a literal newline or tab inside a
brace expansion, and users who do probably do not mean for it to be
stripped, so I believe this is a good change in general.

Fixes #6564
2020-02-04 11:49:12 -08:00
ridiculousfish
97c456a986 Improve support for job control in non-interactive scenarios
Avoid complaining about ENOTTY results from tcsetpgrp, and ensure we
ignore SIGTTOU the first time job control is enabled.
2020-01-30 15:18:10 -08:00
Fabian Homborg
e8000cfea9 Add Solaris' error message to a test
Just another version of the error. We still want to get a bug if it
ever triggers a *wrong* error, so we still list all the options
instead of going for `.*option:.*Z.*`.

Fixes #6554
2020-01-30 18:07:03 +01:00
Fabian Homborg
9cbd3d57a0 Tests: Don't remove a parent of $PWD
Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e9244
Fixes #6555
Fixes #6558
2020-01-30 17:34:48 +01:00
ridiculousfish
7a2a6d76f3 Migrate a test from C++ to littlecheck
This eliminates noisy warnings about tcsetpgrp when the tests are run
without a tty, as reported in #6539
2020-01-26 20:59:08 -08:00
Fabian Homborg
3bb15defbb
Replace debug() with flog
PR #6511 

Flog has the advantage of having *categories*, not severities, so it'll be easier to get output for a certain subsystem now.
2020-01-26 14:13:17 +01:00
ridiculousfish
38f4330683 Rationalize $status and errors
Prior to this fix, fish was rather inconsistent in when $status gets set
in response to an error. For example, a failed expansion like "$foo["
would not modify $status.

This makes the following inter-related changes:

1. String expansion now directly returns the value to set for $status on
error. The value is always used.

2. parser_t::eval() now directly returns the proc_status_t, which cleans
up a lot of call sites.

3. We expose a new function exec_subshell_for_expand() which ignores
$status but returns errors specifically related to subshell expansion.

4. We reify the notion of "expansion breaking" errors. These include
command-not-found, expand syntax errors, and others.

The upshot is we are more consistent about always setting $status on
errors.
2020-01-25 17:28:41 -08:00
ridiculousfish
8a9c39d433 Add a test for some 'status' subcommands 2020-01-25 14:10:45 -08:00
ridiculousfish
788f359cda Make the cd check more robust on macOS
macOS `mktemp -d` likes to return symlinks. Guard against that possibility.
That allows the test to succeed when run directly, instead of through the
build target.
2020-01-25 12:59:18 -08:00
Fabian Homborg
cf508ee228 tests/job-ids: Wait for job to die
It was possible to start the new job and execute `jobs` again before
the job died (or we noticed it did), so the test would fail.

To properly test, we need to ensure the job has been removed. `wait`
should do it.
2020-01-25 14:06:34 +01:00
ridiculousfish
b99546e7a0 Port cmdsub tests to littlecheck 2020-01-24 15:03:59 -08:00
ridiculousfish
2af710f7c0 Eliminate expand_result_t::wildcard_match
This was an internal implementation detail that all callers had to deal
with. Just get rid of it.
2020-01-22 11:49:59 -08:00
Fabian Homborg
65397d4f5e Fix tests
By changing to flog I inadvertently changed the warning text from "<W>
fish:" to "warning:".

Since that's also okay, let's leave it.
2020-01-19 15:07:06 +01:00
ridiculousfish
d38db1bc61 Add a test for deep command substitutions 2020-01-18 11:50:50 -08:00
Johannes Altmanninger
b18f605e4f Fix completions if previous arg is a variable
complete -C'echo $HOM ' would complete $HOM instead of a new token.
Fixes another regression introduced in
6fb7f9b6b - Fix completion for builtins with subcommands
2020-01-18 20:21:10 +01:00
Fabian Homborg
14fd4570d5 Test using more than 64 threads
See #6503
2020-01-18 10:43:59 +01:00
Johannes Altmanninger
b62fa53807 set error code on failed command substitution to 255 instead of -1
the exit status ought to be in 0-255, e.g. exit -1
2020-01-17 17:36:18 +01:00
Johannes Altmanninger
05ddda9155 use variable assignments on commandline in completions
Fixes #6507

To do: If a variable assignment uses a command substitution that errors,
the error is printed, but without a proper location.
2020-01-17 14:53:35 +01:00
ridiculousfish
1da09f2c52 Ensure new job IDs are never smaller than existing running jobs
This makes job IDs "monotone" in the sense that newly spawned jobs
always have larger IDs than existing jobs, as requested in #6053
2020-01-16 16:01:29 -08:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00
Johannes Altmanninger
9a355d5482 complete: replace confusing comment with test case 2020-01-08 17:53:46 +01:00
Johannes Altmanninger
75fa3b6bae unbreak missing argument error on long option 2020-01-08 17:33:36 +01:00
Johannes Altmanninger
fdf398e435 show missing argument error only for last flag
closes #6483
2020-01-08 14:59:26 +01:00
Johannes Altmanninger
0e707b88f0 argparse: fix error message for missing option argument
case #1 in #6483
2020-01-08 14:38:05 +01:00
Johannes Altmanninger
992c864f26 Don't overwrite unrelated variables with for-loop-variables
for-loops that were not inside a function could overwrite global
and universal variables with the loop variable.  Avoid this by making
for-loop-variables local variables in their enclosing scope.

This means that if someone does:

    set a global
    for a in local; end
    echo $a

The local $a will shadow the global one (but not be visible in child
scopes). Which is surprising, but less dangerous than the previous
behavior.

The detection whether the loop is running inside a function was failing
inside command substitutions. Remove this special handling of functions
alltogether, it's not needed anymore.

Fixes #6480
2020-01-08 09:10:14 +01:00
Norio Nomura
cc7618985a Don't override exit status when stderr is closed by 2>&-
fixes #6470
2020-01-07 19:57:35 +01:00
Fabian Homborg
24970bb549 checks: Use "sleep" without "s" suffix
FreeBSD's sleep doesn't accept it.
2020-01-05 18:41:56 +01:00
ridiculousfish
62302ee172 Properly print leading comments and indentation in functions
Store the entire function declaration, not just its job list.
This allows us to extract the body of the function complete with any
leading comments and indents.

Fixes #5285
2020-01-03 14:40:28 -08:00
Johannes Altmanninger
c3374edc59 Reject time with background jobs
This check could probably done earlier in the parser but it works.
2020-01-03 01:07:49 -06:00
Johannes Altmanninger
3de95038b0 Make "time" a job prefix
In particular, this allows `true && time true`, or `true; and time true`,
and both `time not true` as well as `not time true` (like bash).

time is valid only as job _prefix_, so `true | time true` could call
`/bin/time` (same in bash)

See discussion in #6442
2020-01-03 01:07:49 -06:00
ridiculousfish
efa9d5dd6a Port cd tests to littlecheck 2019-12-31 14:16:20 -08:00
ridiculousfish
91404f1762 Rename job_ids check to job-ids
Other tests use a dash.
2019-12-31 13:32:04 -08:00
ridiculousfish
9a11c03097 Correct the job_ids test on the Mac
The Mac doesn't provide CPU percentages so the column is omitted, causing
the test to fail. Use a regex to cover both cases.
2019-12-31 13:17:26 -08:00
ridiculousfish
b691d3130e Don't give job IDs to block processes either
Extend the commit 8e17d29e04 to block processes, for example:

    begin ; stuff ; end

or if/while blocks as well.

Note there's an existing optimization where we do not create a job for a
block if it has no redirections.
2019-12-31 13:12:24 -08:00
ridiculousfish
a6e5583b5b Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:

    std::rotate(begin, job, end)

However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].

Correct this by replacing it with:

    std::rotate(begin, job, job+1);

now we get the desired [2, 1, 3].

Also add a test.
2019-12-31 12:41:11 -08:00
Johannes Altmanninger
9f48fc6285 Fix status when function/block evaluation is cancelled
It looks like the last status already contains the signal that cancelled
execution.

Also make `fish -c something` always return the last exit status of
"something", instead of hardcoded 127 if exited or signalled.

Fixes #6444
2019-12-23 17:38:19 +01:00
ridiculousfish
97dd5ece26 Remove redirection_is_to_real_file
This was previously required so that, if there was a redirection to a
file, we would fork a process to create the file even if there was no
output. For example `echo -n >/tmp/file.txt` would have to create
file.txt even though it would be empty.

However now we open the file before fork, so we no longer need special
logic around this.
2019-12-20 14:40:57 -08:00
Fabian Homborg
dcf8b0e3aa Add test for time 2019-12-20 17:13:21 +01:00
Johannes Altmanninger
1410f938aa read: discard IFS delimiters before the last token
Do this only when splitting on IFS characters which usually contains
whitespace characters --- read --delimiter is unchanged; it still
consumes no more than one delimiter per variable. This seems better,
because it allows arbitrary delimiters in the last field.

Fixes #6406
2019-12-19 23:44:58 +01:00
Mahmoud Al-Qudsi
d90d4f849c Force symlink creation in realpath tests
If an earlier test was aborted, the symlink would still be present and
the subsequent run will fail to create the symlink as it wasn't forced.
2019-12-18 12:31:24 -06:00
Johannes Altmanninger
b1144a1fde completion: fix file completion of redirection targets
This fixes a regression introduced in
6fb7f9b6b - Fix completion for builtins with subcommands
2019-12-16 12:45:39 +01:00
ridiculousfish
9be77d1f9c Correctly handle "self fd redirections"
This adds a test for the obscure case where an fd is redirected to
itself. This is tricky because the dup2 will not clear the CLO_EXEC bit.
So do it manually; also posix_spawn can't be used in this case.
2019-12-13 16:51:49 -08:00
ridiculousfish
d6c71d77a9 Correctly cloexec file redirections
The IO cleanup left file redirections open in the child. For example,
/bin/cmd < file.txt would redirect stdin but also leave the file open.
Ensure these get closed properly.
2019-12-13 16:16:19 -08:00
ridiculousfish
c0b3be9fb4 Stop storing block_io in job_t
Prior to this fix, a job would hold onto any IO redirections from its
parent. For example:

    begin
        echo a
    end < file.txt

The "echo a" job would hold a reference to the I/O redirection.
The problem is that jobs then extend the life of pipes until the job is
cleaned up. This can prevent pipes from closing, leading to hangs.

Fix this by not storing the block IO; this ensures that jobs do not
prolong the life of pipes.

Fixes #6397
2019-12-11 16:34:20 -08:00
ridiculousfish
92a16921bf Add a test to verify that processes get the right pgrps in pipelines 2019-12-08 13:45:24 -08:00
ridiculousfish
d47541a3d7 Add a tricky test to verify disowning an in-flight job
There's some logic in fish to prevent blowing up when an under-construction
job is disowned. Add a test for it.
2019-12-08 11:44:21 -08:00
ridiculousfish
098fe86ebf Port empty functions test to littlecheck 2019-12-07 11:02:22 -08:00
Fabian Homborg
115892ccd2 alias: Use read --tokenize
This did some weird unescaping to try to extract the first word.

So we're now more likely to be *correct*, and the alias benchmark is
about 20% *faster*.

Call it a win-win.
2019-12-01 18:14:26 +01:00
Fabian Homborg
86133b0a2b Add read --tokenize
This splits a string into variables according to the shell's
tokenization rules, considering quoting, escaping etc.

This runs an automatic `unescape` on the string so it's presented like
it would be passed to the command. E.g.

    printf '%s\n' a\ b

returns the tokens

printf
%s\n
a b

It might be useful to add another mode "--tokenize-raw" that doesn't
do that, but this seems to be the more useful of the two.

Fixes #3823.
2019-12-01 18:14:26 +01:00
Fabian Homborg
662fb3f3d1 Fix line numbers in functions
This added the function offset *again*, but it's already included in
the line for the current file.

And yes, I have explicitly tested a function file with a function
defined at a later line.

Fixes #6350
2019-11-26 18:12:24 +01:00
Johannes Altmanninger
f36705bb66 Fix error messages for "and" and "or" after pipe
Fixes #6347
2019-11-26 14:03:53 +01:00
Johannes Altmanninger
97969a9363 Restore error messages for bare variable assignment
Since #6287, bare variable assignments do not parse, which broke
the "Unsupported use of '='" error message.

This commit catches parse errors that occur on bare variable assignments.
When a statement node fails to parse, then we check if there is at least one
prefixing variable assignment. If so, we emit the old error message.

See also #6347
2019-11-26 13:59:17 +01:00
Jason
3cf6ebc0e1 Amend typos and grammar errors 2019-11-25 13:07:15 +01:00
Johannes Altmanninger
7d5b44e828 Support FOO=bar syntax for passing variables to individual commands
This adds initial support for statements with prefixed variable assignments.
Statments like this are supported:

a=1 b=$a echo $b        # outputs 1

Just like in other shells, the left-hand side of each assignment must
be a valid variable identifier (no quoting/escaping).  Array indexing
(PATH[1]=/bin ls $PATH) is *not* yet supported, but can be added fairly
easily.

The right hand side may be any valid string token, like a command
substitution, or a brace expansion.

Since `a=* foo` is equivalent to `begin set -lx a *; foo; end`,
the assignment, like `set`, uses nullglob behavior, e.g. below command
can safely be used to check if a directory is empty.

x=/nothing/{,.}* test (count $x) -eq 0

Generic file completion is done after the equal sign, so for example
pressing tab after something like `HOME=/` completes files in the
root directory
Subcommand completion works, so something like
`GIT_DIR=repo.git and command git ` correctly calls git completions
(but the git completion does not use the variable as of now).

The variable assignment is highlighted like an argument.

Closes #6048
2019-11-25 09:20:51 +01:00
Fabian Homborg
aae111584d Disable localized number test on OpenBSD
This feature simply does not work there.
2019-11-16 12:11:09 +01:00
Ankush Patil
ee982c4f6c Fixes #6280 : Added right associativity to 'pow' function 2019-11-13 13:51:01 -08:00
ridiculousfish
2555ecf757 Remove the forbidden function stack
Detect forbidden functions directly from the associated block_t.
Also unify where we do stack overflow detection.
2019-11-10 12:36:46 -08:00
ridiculousfish
626237c9c3 Add a check for fish function stack overflow 2019-11-10 12:35:58 -08:00
Fabian Homborg
d77c465d23 string: Allow -eq again
Instead of forbidding it for both modes, allow it for both and make it
quiet for string.

Fixes #6282
2019-11-04 17:34:37 +01:00
Johannes Altmanninger
6fb7f9b6b8 Fix completion for builtins (with subcommands)
Presently the completion engine ignores builtins that are part of the
fish syntax. This can be a problem when completing a string that was
based on the output of `commandline -p`.  This changes completions to
treat these builtins like any other command.

This also disables generic (filename) completion inside comments and
after strings that do not tokenize.

Additionally, comments are stripped off the output of `commandline -p`.

Fixes #5415
Fixes #2705
2019-11-04 16:44:51 +01:00
ridiculousfish
72bf5898d3 Clean up how PATH and CDPATH munging occurs
PATH and CDPATH have special behavior around empty elements. Express this
directly in env_stack_t::set rather than via variable dispatch; this is
cleaner.
2019-11-02 16:48:08 -07:00
ridiculousfish
a7f1d2c0c7 Add support for fish_trace variable to trace execution
This adds support for `fish_trace`, a new variable intended to serve the
same purpose as `set -x` as in bash. Setting this variable to anything
non-empty causes execution to be traced. In the future we may give more
specific meaning to the value of the variable.

The user's prompt is not traced unless you run it explicitly. Events are
also not traced because it is noisy; however autoloading is.

Fixes #3427
2019-11-02 14:40:57 -07:00
Fabian Homborg
c0d8439f3a math: Print special error for logical operators
Until now, something like

`math '7 = 2'`

would complain about a "missing" operator.

Now we print an error about logical operators not being supported and
point the user towards `test`.

Fixes #6096
2019-11-01 08:43:13 +01:00
0x005c
067b30208d Fix math incorrect parenthesis error on missing term 2019-10-31 22:10:54 +01:00
ridiculousfish
0bfd897ee0 Add a special error message for |& 2019-10-27 15:24:57 -07:00
ridiculousfish
2a92e66902 Support for &> and &| as convenience redirections
This adds support for &> and &| syntax, which both redirect stdout, and
also apply a redirection of stderr to stdout.
2019-10-27 15:24:57 -07:00
Fabian Homborg
66938d206a string: Error out on match -eq
The `--entire` would enable output even though the `--quiet` should
have silenced it. These two don't make any sense together so print an
error, because the user could have just left off the `-q`.
2019-10-22 22:11:36 +02:00
Johannes Altmanninger
b7f35f949e Do not import vars that are equivalent to a universal exported var
Universal exported variables (created by `set -xU`) used to show up
both as universal and global variable in child instances of fish.

As a result, when changing an exported universal variable, the
new value would only be visible after a new login (or deleting the
variable from global scope in each fish instance).

Additionally, something like `set -xU EDITOR vim -g` would be imported
into the global scope as a single word resulting in failures to
execute $EDITOR in fish.

We cannot simply give precedence to universal variables, because
another process might have exported the same variable.  Instead, we
only skip importing a variable when it is equivalent to an exported
universal variable with the same name.  We compare their values after
joining with spaces, hence skipping those imports does not change the
environment fish passes to its children. Only the representation in
fish is changed from `"vim -g"` to `vim -g`.

Closes #5258.
This eliminates the issue #5348 for universal variables.
2019-10-19 12:41:57 +02:00
Johannes Altmanninger
5e274066e3 Always return absolute path in path_get_cdpath
Fixes #6220
2019-10-19 12:38:17 +02:00
Johannes Altmanninger
eae1683033 Completion: complete argument to last of a group of short options
Consider a group of short options, like -xzPARAM, where x and z are options and z takes an argument.

This commit enables completion of the argument to the last option (z), both within the same
token (-xzP) or in the next one (-xz P).

complete -C'-xz' will complete only parameters to z.
complete -C'-xz ' will complete only parameters to z if z requires a parameter
otherwise, it will also complete non-option parameters

To do so this implements a heuristic to differentiate such strings from single long options. To
detect whether our token contains some short options, we only require the first character after the
dash (here x) to be an option. Previously, all characters had to be short options. The last option
in our example is z. Everything after the last option is assumed to be a parameter to the last
option.

Assume there is also a single long option -x-foo, then complete -C'-x' will suggest both -x-foo and
-xy. However, when the single option x requires an argument, this will not suggest -x-foo.
However, I assume this will almost never happen in practise since completions very rarely mix
short and single long options.

Fixes #332
2019-10-16 11:30:50 +02:00
ridiculousfish
ca11b5edc8 Add a simple test for SIGINT out of loops 2019-10-15 22:33:53 -07:00
Johannes Altmanninger
cf3b24cf62 fix typo 2019-10-15 13:30:21 +02:00
Aaron Miller
15ed682bfa Fix options after --argument-names to function (#6188)
This stops reading argument names after another option appears. It does not break any previous uses and in fact fixes uses like

```fish
function foo --argument-names bar --description baz
```

* `function` command handles options after argument names (Fixes #6186)

* Removed unneccesary test
2019-10-10 18:09:26 +02:00
Fabian Homborg
ff18b2a09a Fix tests
This didn't account for the path differing from when I ran the test
manually.

Sorry!
2019-10-08 19:12:56 +02:00
Fabian Homborg
a7913c3a10 function: Reject invalid variable names for --argument-names
Fixes #6147.
2019-10-07 21:26:41 +02:00
Johannes Altmanninger
f91c725ff0 Fix caret position of invalid expansion in command position
Fixes #5812
2019-10-06 13:43:05 -07:00
Johannes Altmanninger
9b86d5dd16 Export all local exported variables in a new scope
Fixes #6153
2019-10-06 12:10:21 -07:00
Johannes Altmanninger
7017a2fcf9 Unexpand abbreviations' variable names before completing them
Fixes #6166
2019-10-06 14:42:42 +02:00
Johannes Altmanninger
e167714899 Raise the recursion limit of complete
Users should generally prefer to use complete --wraps but this
corrects some unexpected behavior.

Fixes #3474
2019-10-03 21:25:19 +02:00
Johannes Altmanninger
aa011f70a8 Print an error when complete reaches its recursion limit 2019-10-03 21:25:19 +02:00
ridiculousfish
5f64972908 Do not try the same (command, wraps) pair more than once when completing
This prevents runaway wrap chains. Fixes #5638.
2019-09-21 14:09:38 -07:00
Aaron Gyes
102ddd2b79 tests/checks/complete.fish: don't check unsorted lines 2019-09-19 15:44:15 -07:00
Aaron Gyes
6459682c93 Work around indeterminant ordering for complete test
Not a cool fix but it should work
2019-09-19 15:35:25 -07:00
Aaron Gyes
53a3533285 Add tests for complete (no args) output
Hopefully this should catch things if the output gets broken again.
2019-09-19 15:01:09 -07:00
Aaron Gyes
61f0756fe6 builtins: Use standard builtin.h error macros more 2019-09-17 22:04:33 -07:00
ridiculousfish
fa6bac1283 Correctly implement and --help and or --help 2019-09-08 10:42:24 -07:00
Aaron Gyes
47798510bd tests, CHANGELOG: regex-easyesc
Oops, missed these the first time around.
2019-08-13 22:56:31 -07:00
Fabian Homborg
6500765256 Allow switch with something that expands to nothing
Meaning empty variables, command substitutions that don't print
anything.

A switch without an argument

```fish
switch
   case ...
end
```

is still a syntax error, and more than one argument is still a runtime
error.

The none-argument matches either an empty-string `case ''` or a
catch-all `case '*'`.

Fixes #5677.

Fixes #4943.
2019-07-31 14:08:28 +02:00