Commit Graph

4773 Commits

Author SHA1 Message Date
Qi Xiao
ba36492d16 .cirrus.yml: Bump test time scale to 20. 2020-08-16 15:50:46 +01:00
Qi Xiao
de64aa9db3 Release 0.14.1. 2020-08-16 14:40:38 +01:00
Qi Xiao
a90e8eb75d Revert "Eliminate sys.Ioctl"
Results in "failed to put myself in foreground" errors.

This reverts commit bea90271b0.
2020-08-16 14:23:37 +01:00
Kurtis Rader
bea90271b0 Eliminate sys.Ioctl
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 
2020-08-16 14:14:48 +01:00
Qi Xiao
8f410a24be pkg/util: Move environment variable names to a new package.
Also document that this package should be broken up.
2020-08-16 14:12:48 +01:00
Qi Xiao
8aa9c26ba2 Small fixup for .
* Call decSHLVL from execFn.

* Rephrase doc comment.
2020-08-16 14:08:48 +01:00
Kurtis Rader
30d1161ded Replace "USERNAME" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
a4e539c823 Replace "ELVISH_TEST_TIME_SCALE" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
947ac39876 Replace "XDG_RUNTIME_DIR" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
e04c503431 Replace "LS_COLORS" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
b9d515dd78 Replace "PATHEXT" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
b2c7746bf6 Replace "PATH" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
19f315e28a Replace "PWD" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
f656f9511b Replace "HOME" literals with a constant 2020-08-16 14:05:13 +01:00
Kurtis Rader
ade5fa6c76 Fix exec handling of $E:SHLVL
Fixes 
2020-08-16 14:05:13 +01:00
Qi Xiao
af92608f07 Document style guide for the doc comment of unexported types and functions. 2020-08-16 14:00:04 +01:00
Qi Xiao
239ce3ec0d pkg/eval/testutil.go: Expand the comments on the Throws* methods. 2020-08-16 13:51:48 +01:00
Qi Xiao
e2f08af91b Change slice syntax to use .. instead of :.
Also support ..= for closed-range slices, a la Rust.

The old syntax is still supported, but deprecated.

This fixes .
2020-08-15 22:52:50 +01:00
Qi Xiao
b2b18bff97 Bump minimal Go requirement to >= 1.14, now that 1.15 has been released. 2020-08-13 22:41:57 +01:00
Qi Xiao
0c72fcd5b1 Small fixup for . 2020-08-13 22:14:16 +01:00
Gabriel Rauter
1124c10b56
Add str:from-utf8-bytes, str:to-utf8-bytes and move builtin ord and chr to str module ()
* pkg/eval/str: move builtin ord and chr to str

Move builtin string function ord and chr to the str module and rename to
to str:to-codepoints and str:from-codepoints respectively as suggested
in .

* pkg/eval/str: add from-utf8-bytes & to-utf8-bytes

Add from-utf8-bytes and to-utf8-bytes functions to the str module. This
functions differ from their *-codepoints in that they handle utf8 bytes
instead of whole codepoints. Closes 

* pkg/eval/str: range check for codepoint and bytes

str:from-codepoints
Add check if arguments codepoints are within valid unicode range, return
an OutOfRange error otherwise. Return a BadValue error if the codepoint
isn't valid. Add/change testcases.

str:from-utf8-bytes
Add check if byte arguments are within valid range, return an OutOfRange
error otherwise. Return a BadValue error if the byte sequence isn't a
valid UTF-8 sequence. Add/change testcases.

Add additional test if piping from str:to-codepoints/str:to-utf8-bytes
to str:from-codpoints/str:from-utf8-bytes returns the original input.
2020-08-13 21:56:28 +01:00
Qi Xiao
c42755892e Pin prettier version to 2.0.5 in both CI and CONTRIBUTING.md. 2020-08-11 18:57:10 +01:00
Kurtis Rader
082052b5a8 Document double-quoted string escape sequences 2020-08-11 16:07:58 +01:00
Kurtis Rader
fbd86925a9 Prevent I/O deadlocks during shell testing
If the shell outputs more data than can be buffered the test will
deadlock. I noticed this when working on issue . The tests I was
writing would deadlock because a tty can buffer significantly less data
than a pipe. Even using a pipe, which typically buffers 8 to 128 KiB, this
is theoretically a problem. So use a goroutine to capture the output as it
is generated rather than reading it all at once when the test terminates.
2020-08-11 15:58:20 +01:00
Kurtis Rader
3643f252f3 Verify stdout and stderr in shell tests
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.
2020-08-11 15:58:20 +01:00
Kurtis Rader
3300c81c8b Document break, continue, and return
Since `break`, `continue`, and `return` are builtin commands, rather
than language keywords, they should be documented on the builtin module
reference page.
2020-08-04 23:08:41 +01:00
Kurtis Rader
a3f66b52af Document underscores in number literals 2020-08-01 23:08:11 +01:00
Kurtis Rader
eb2a792301 Fix some lint warnings
In addition to an uncontroversial spelling fix this addresses several,
related, warnings produced by the `golint` tool. In general I agree with
golint that unnecessary "else" blocks should be avoided. So this change
refactors those cases.

Note: I recognize that `golint` is deprecated (see
https://github.com/golang/go/issues/38968) since it is no longer being
maintained and there is controversy about its set of warnings. Nonetheless,
it appears that the warnings it emits for this project are all reasonable
and actionable with one potential exception: the naming of the `map_`
method in pkg/eval/compile_value.go.
2020-08-01 23:07:50 +01:00
Kurtis Rader
1b5ce7f265 Fix the handling of go test -race
The `test-race-works && go test -race || go test` formulation causes
tests to be run twice on platforms that support the `-race` option if
any test fails.

Fixes 
2020-08-01 23:05:59 +01:00
Qi Xiao
d2e7201163
Makefile: Simplify the "test" target.
* Call "go env" just once.

* Use grep -x to match whole line.
2020-07-27 12:24:28 +01:00
Qi Xiao
a77261e4ea Makefile: Run tests with -race only on platforms that support it.
This fixes .
2020-07-25 17:03:49 +01:00
Kurtis Rader
5f0b72ab4f rephrase float64 description 2020-07-25 16:25:23 +01:00
Kurtis Rader
cff229d9fa Remove two obsolete TODO comments and resolve one 2020-07-25 16:25:23 +01:00
Kurtis Rader
9858d5a545 Add missing deprecation text for explode
Also, fix trivial typo in a comment as reported at
https://goreportcard.com/report/github.com/elves/elvish
2020-07-21 22:51:53 +01:00
Qi Xiao
eb25c882ae Allow failures in the gccgo task.
This fixes .
2020-07-21 22:46:28 +01:00
Qi Xiao
e5e0446c5a Warn about deprecated syntax features in imported modules.
This fixes .
2020-07-15 00:04:03 +01:00
Shengjing Zhu
45b12127f6 pkg/eval: Don't hardcode signal name in test
On gccgo signal name is capitalized.
2020-07-14 20:49:03 +01:00
Shengjing Zhu
b52ca6b530 pkg/eval/platform: Add workaround for failing test on gccgo 2020-07-14 20:49:03 +01:00
Shengjing Zhu
d9454b4f4a .cirrus.yml: Add gccgo support 2020-07-14 20:49:03 +01:00
Qi Xiao
c2c6254316 pkg/edit: Fix race conditions. 2020-07-14 20:43:11 +01:00
Qi Xiao
b18b833acb Upgrade the xiaq/persistent dependency.
The new version supports nil keys for maps. This fixes .
2020-07-14 00:38:21 +01:00
Qi Xiao
3501b945aa Rewrite pkg/cli/histutil.
- Organize code around two interfaces, Store and Cursor.

- Ensure that a session store is always available, even if the DB is not
  accessible.

This fixes .
2020-07-13 23:46:43 +01:00
Qi Xiao
8995bc5663 Fix build. 2020-07-11 14:26:30 +01:00
Qi Xiao
7ddcc5b1b5 pkg/sys: Document why it's necessary to call signal.Ignore. 2020-07-11 14:26:30 +01:00
Shengjing Zhu
4e4462053b Remove PPA from website
It hasn't been updated since 2018
2020-07-11 14:21:35 +01:00
Kurtis Rader
c30a9ff9ad Tell external cmds to ignore job control signals
Since elvish does not support job control it should run all external
commands with the tty job control signals set to be ignored. See "APUE",
third edition, page 379.

This doesn't actually fix the problem in the case of broken programs
like vim which blindly assume the parent process implements job control.
But there isn't much we can do about that other than try to get those
programs to pay attention to being told to ignore SIGTSTP.

Fixes 
2020-07-11 14:18:42 +01:00
Kurtis Rader
1045fa3d1f Panic during shell unit tests should be failures
While debugging my fix for issue  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.
2020-07-11 14:16:48 +01:00
Qi Xiao
32328bb48b Simplify Makefile. 2020-07-06 22:28:49 +01:00
Qi Xiao
0c9014114e Allow codecov upload to fail.
Codecov's API endpoint is sometimes unstable. The CI should not fail when the
upload fails.
2020-07-05 19:18:57 +01:00
Qi Xiao
617d657896 Update download link for 0.14.0 to use the release instead of rc. 2020-07-05 18:57:03 +01:00