Also remove unused functions.
There were two (correct) implementations of deciding whether a string has
another string as a subsequence; keep the more performant one.
Most of the code uses keyed fields in composite literals; i.e., struct
literals. However, running `go vet ./...` reports a few places that use
anonymous fields. This modifies those composite literals to use keyed
fields. This does make the code a bit more verbose without reducing
the likelihood of a bug. But it does make the code more consistent, use
best practices, and make it easier to notice if a potential problem is
introduced when running `go vet ./...` since that command now produces
no diagnostic output.
I considered adding a `make vet` target that explicitly ran
go vet -composites=false ./...
I decided not to do that since consistently using keyed composite literals
is preferable to having a mix of keyed and unkeyed composite literals.
This also removes the unused `ExampleLoop` function which causes this
`go vet` warning:
pkg/cli/loop_test.go:130:1: ExampleLoop refers to unknown identifier: Loop
Improve coverage of pkg/eval/external_cmd.go from 58.3% to 86.1% as
measured by `make test` on macOS.
This would have been a smaller change but I felt it was important to
actually validate the exception raised when an external command fails
rather than simply using `.ThrowsAny()`. That necessitated augmenting
the pkg/eval/testutils.go module.
Related #1062
I was reviewing test coverage and noticed that the `esleep`
implementation was undocumented and had no tests. This
a) implements `sleep` and deprecates `esleep`,
b) uses the Go time.ParseDuration function rather than assuming a
simple number of seconds,
c) documents the command,
d) adds tests of the function.
Related #1062
I started by writing tests for sys.Ioctl but after I had 100% coverage
of that function it occurred to me the function could be eliminated.
Related #1062
Running "go test -race" on Windows requires GCC, and it appears not all GCC
builds are compatible. Since we can't reliably determine whether the environment
has a good GCC for running the race detector, just don't enable it.
This resolves#1108.