Qi Xiao
0adf0ec147
Use the unix build tag.
...
The unix build tag is supported by Go 1.19.
2023-03-03 00:01:26 +00:00
Kurtis Rader
358e52a7f5
Make testing compilation errors more deterministic
...
A year ago I submitted a change to replace AnyError with tests for specific
errors (see https://github.com/elves/elvish/commit/87656c99 ). This does
something similar for DoesNotCompile. This ensures the test does what
is implied and makes correlating specific unit tests with compilation
errors easier.
This includes a couple of changes to compilation error messages to improve
readability (IMHO) but those are not the primary purpose of this change.
Related #1560
2022-11-20 16:33:29 +00:00
Qi Xiao
4afbb71c07
Move pkg/testutil/must.go to a new pkg/must.
2022-06-20 20:29:14 +01:00
Qi Xiao
f7cb556d9b
Require Go 1.18.
...
- Run "go fix" to remove legacy build tags
- Use staticcheck@master until it has a release that supports Go 1.18
- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00
Qi Xiao
862cf5619d
Support turning off implicit external command resolution.
...
See documentation in website/ref/language.html.
This fixes #978 .
2021-10-07 01:21:28 +01:00
Qi Xiao
d0be34c227
Run gofmt with Go 1.17.
...
This has created a lot of //go:build lines.
2021-08-23 00:19:49 +01:00
Qi Xiao
e9d328aa16
Make use of (*testing.T).Cleanup for test cleanups.
...
This allows turning the following pattern in tests:
value, cleanup := setupSomething()
defer cleanup()
into the following:
value := setupSomething(t)
2021-08-06 23:21:23 +01:00
Qi Xiao
adf8066819
pkg/testutil: Make MustWriteFile easier to use.
...
The function now take a string for the file content, and always uses 0600 for
file permission.
2021-08-06 21:38:37 +01:00
Qi Xiao
5fa39e1155
Fix the sequencing between closing pipes and setting readerGone.
...
For some reason this wrong sequencing was only discovered on FreeBSD, and the
test reliably pass on macOS (likely differences in scheduling algorithms).
Also make the bug a bit easier to reproduce on FreeBSD by using an external
command on the reader side. Builtin commands are too quick to execute.
2021-06-25 13:51:52 +01:00
Qi Xiao
657b73122f
Change all builtin commands writing value output to surface ReaderGone.
...
Also replace (*Frame).OutputChan with (*Frame).ValueOutput, which returns a
small interface for writing to the value output that is also aware when the
reader is gone.
2021-06-18 00:14:59 +01:00
Qi Xiao
067c809fc5
Change all builtin commands that write to byte output to surface write errors.
...
Also replace (*Frame).OutputFile with (*Frame).ByteOutput, which returns a
small interface for writing bytes and converts EPIPE to ReaderGone.
2021-06-11 22:20:27 +01:00
Qi Xiao
641f0ebf04
Detect and suppress SIGPIPE caused by the next command in a pipeline exiting early.
...
This addresses #952 .
2021-05-20 00:10:17 +01:00
Qi Xiao
196eea21d4
Change module import path to src.elv.sh
2021-01-27 01:30:25 +00:00
Qi Xiao
f3c2185dae
pkg/eval/evaltest: Move Must* functions to the testutil package.
...
Also exclude those functions from test coverage calculation.
2020-09-04 21:57:20 +01:00
Qi Xiao
bb122024dd
pkg/eval: Move test framework into new evaltest package.
2020-09-03 06:51:21 +01:00
Qi Xiao
48919bcb24
pkg/: Move test utilities from util/ to testutil/.
2020-09-03 04:55:16 +01:00
Qi Xiao
fbc18ba55d
pkg/eval: Rewrite glob tests.
2020-04-17 00:40:47 +01:00
Qi Xiao
33da89f34f
pkg/eval: Clean up API.
...
Unexport some of the test utilities, and remove unused AddDirer.
2020-04-10 18:10:42 +01:00
Qi Xiao
6189fd372f
Fix crash when running external command with port table nil values.
...
This fixes #788 (for real; a regression test has been added).
2020-01-12 12:32:25 +00:00
Qi Xiao
64b104f533
Support dynamic command names for unambiguous external commands.
...
This fixes #764 .
2020-01-11 18:57:39 +00:00