Qualified imports of pkg/testutil outnumber unqualified (55 to 7). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.
Instead of putting all possible flags in prog.Flags, flags are now registered by
the individual subprograms. The 3 flags -sock, -db and -json are shared by
multiple subprograms and still handled by the prog package.
This new design allows separating the support for -cpuprofile into a separate
subprogram, which is no longer included by the default entry point, making the
binary slightly smaller. A new entrypoint "withpprof" is created.
Also include the LSP subprogram in the nodaemon entry point.
In particular, the code for retrieving file paths needed by the runtime is
simplified a lot, and the paths only needed for the storage daemon is cleanly
separated from other paths.
This change makes Ns immutable from the exposed API. Internally there is exactly
one place that still mutates Ns, in scopeOp; this will be addressed later.
While working on my next commit, to prevent I/O deadlocks, I experienced
some problems because I had a syntax error in the Elvish code to generate
the output. That wasn't immediately obvious because I had copied another
test that only tested the stdout of the shell and the syntax error was
written to stderr. This change modifies existing tests to verify both
stdout and stderr have the expected content.
Note that there are three interactive tests for which we still do not
verify the content of stderr. That's because stderr for those tests only
contains a shell prompt whose content changes each time the test is run.
TBD is modifying the interactive tests to have a predictable prompt.
While debugging my fix for issue #661 I noticed that a panic that invokes
the `rescue` function causes Go to think the test passed due to launching
a rescue shell. This introduces a mechanism for elvish unit tests to
request that panics be fatal; i.e., exit with a non-zero status rather
than launch a rescue shell.
This also changes the behavior of panics by non-interactive elvish
shells to no longer launch an unexpected rescue shell.