Sauyon Lee
7ec375e583
pkg/edit: Add makeTransform helper for modifying content and dot
2021-11-07 14:50:57 +00:00
Sauyon Lee
56cfb06f9a
pkg/edit: Factor out some word logic into helper functions
2021-11-07 14:50:57 +00:00
Qi Xiao
c1dce661b7
Fix use of the builtin module via explicit "builtin".
...
Some of the variables are added after the Evaler is created, but that change was
not synchronized back to the copy of the builtin module that is imported with
"use builtin".
This fixes #1414 .
2021-10-28 22:28:13 +01:00
Qi Xiao
d71e52cbd7
Refactor the API of eval.NsBuilder to be completely based on methods.
2021-10-23 21:44:11 +01:00
Qi Xiao
db68e4e87d
pkg/shell: Increase the waiting time for daemon in test.
2021-10-23 19:50:46 +01:00
Qi Xiao
1c39c2ed97
pkg/shell: Make sure that a test can finish if the daemon doesn't stop.
2021-10-23 18:41:38 +01:00
Qi Xiao
74003a7f56
pkg/daemon: Always quit after receiving a signal.
...
The current code will busy-loop after receiving a signal until the listener
errors or all existing connection returns.
2021-10-23 18:39:55 +01:00
Qi Xiao
b570b2f0b5
pkg/eval: Clean up the Ns type a bit.
2021-10-23 18:18:31 +01:00
Qi Xiao
41cbcfb1b1
Move elvdoc for the re module to the Go source.
2021-10-23 13:31:44 +01:00
Qi Xiao
0fd916c418
Document the &max option of str:split.
2021-10-23 13:19:14 +01:00
Qi Xiao
a25809893e
Clean up flags
...
- Remove the now defunct -web and -port flags.
- Document that -json also works with -compileonly.
2021-10-23 13:04:26 +01:00
Qi Xiao
b42cfaea61
Remove references to ~/.elvish in documentation.
...
This fixes #1399 .
2021-10-23 12:16:50 +01:00
Qi Xiao
a91852b0a7
Fix tests broken by last commit.
2021-10-22 17:44:57 +01:00
Qi Xiao
fc66ad1d10
pkg/eval/vals: Remove support for the legacy a:b slice syntax.
...
This syntax was deprecated in 0.15.0 and no longer documented since then.
2021-10-22 17:41:09 +01:00
Qi Xiao
b12c29fb53
pkg/eval: Remove unnecessary methods of *Ns and *staticNs.
2021-10-16 12:50:45 +01:00
Qi Xiao
6822e2ca7b
Deprecate the local: and up: special namespaces in 0.17.
...
Also deprecate the use of a leading empty namespace.
This addresses #1409 .
2021-10-15 22:45:02 +01:00
Qi Xiao
4b218d9859
Deprecate the legacy lambda syntax from 0.17.x.
...
This addresses #664 .
2021-10-14 23:10:29 +01:00
Qi Xiao
6a92571a23
Check assignments to read-only variable during compilation.
2021-10-13 23:57:14 +01:00
Qi Xiao
20e98c7479
Support new lambda syntax { |arg &opt=default| body }.
...
This addresses #664 .
2021-10-13 22:47:16 +01:00
Qi Xiao
569d73c270
Deprecate the legacy assignment form from 0.17.0.
...
This addresses #645 .
2021-10-12 23:25:45 +01:00
Qi Xiao
6a7d99041d
pkg/eval: Require the variable used in "set" to already exist.
...
This has always been the documented behavior, but up until this point, "set"
actually behaved like the legacy assignment form, which creates the variable if
it doesn't exist yet.
This fixes the discrepancy. Addresses #645 .
2021-10-10 14:31:09 +01: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
5b490475e7
pkg/testutil: ScaledMs -> Scaled, takes a time.Duration instead.
2021-10-05 01:02:54 +01:00
Qi Xiao
e299010be8
pkg/eval: Export the config fields and remove access methods.
2021-10-05 00:53:38 +01:00
Qi Xiao
fc754f6822
pkg/eval: Deliver message for finished bg job using editor notification.
...
This fixes #1067 .
2021-10-05 00:08:14 +01:00
Qi Xiao
e70216421f
pkg/eval: Remove more unnecessary mutex guards.
2021-10-04 23:27:06 +01:00
Qi Xiao
cfaa1ed639
Fix build on Windows
2021-10-04 00:26:48 +01:00
Qi Xiao
6eae543ecf
pkg/eval: Remove unnecessary mutex guards.
2021-10-03 23:57:26 +01:00
Qi Xiao
1f362db665
pkg/eval: Add before-exit hook for daemon cleanup.
...
The daemon client in the Evaler is now only used by the dir-history builtin
command and can be removed when it is removed.
2021-10-03 23:16:20 +01:00
Qi Xiao
56038311da
pkg/eval: Remove elvdoc for the removed path-* commands.
2021-10-03 23:03:52 +01:00
Qi Xiao
7e526534cd
pkg/eval: Remove Eval.libInstallDir; it's not used anywhere.
2021-10-03 23:01:26 +01:00
Qi Xiao
64b52d08aa
pkg/edit: Correct the elvdoc for edit:notify.
2021-10-03 22:58:45 +01:00
Qi Xiao
c6d9ebc389
Add special command "coalesce".
...
This fixes #1404 .
2021-10-03 19:14:44 +01:00
Qi Xiao
0571db69e2
Remove commands deprecated in 0.16.0, and deprecate dir-history.
2021-10-03 16:47:51 +01:00
Qi Xiao
2e6a3abce5
Expose all functionalities of the persistent store in the store: module.
...
This fixes #1032 .
2021-10-03 16:34:52 +01:00
Qi Xiao
68168da9fc
pkg/eval: Convert elements of slice return value from a GoFn to individual outputs.
2021-10-03 16:34:52 +01:00
Qi Xiao
b17e5bd1ad
pkg/shell: Remove an unnecessary import rename.
2021-10-03 14:47:22 +01:00
Qi Xiao
cd62d565ab
pkg/eval: Small test coverage improvements.
2021-10-03 01:54:07 +01:00
Qi Xiao
3526f0284e
pkg/eval: Increase coverage of builtin_fn_flow_test.go.
2021-10-03 01:09:08 +01:00
Qi Xiao
3f418dfd5c
pkg/cli/term: Fix test on Windows.
2021-10-03 00:35:32 +01:00
Qi Xiao
00c26410cc
pkg/cli/term: Increase coverage of buffer.go and reader.go.
2021-10-03 00:29:55 +01:00
Qi Xiao
0219b99add
pkg/cli/term: More tests for convertEvent in reader_windows.go.
2021-10-03 00:03:02 +01:00
Qi Xiao
3172a259b9
Fix cmd/examples/win_tty
2021-10-02 22:44:54 +01:00
Qi Xiao
7961cf2d7a
pkg/cli/term: Add very basic tests against reader_windows.go.
...
We can't test actual console events, but at least we can test the
convertEvent function.
2021-10-02 22:38:02 +01:00
Qi Xiao
3585d933b8
pkg/sys/ewindows: Remove the _windows suffix from most files.
...
All the files in this package are Windows-specific. Use build
constraints to ensure that they don't build on other platforms instead.
2021-10-02 22:38:02 +01:00
Qi Xiao
bfb9986339
pkg/daemon: Fix activate_unix_test.go.
2021-10-02 19:04:36 +01:00
Qi Xiao
eadb0c3283
pkg/daemon: Only test the code to interrupt old daemon on UNIX.
...
Windows does not support sending interrupts to processes without
consoles.
2021-10-02 19:02:28 +01:00
Qi Xiao
4f63beab17
pkg/daemon: Let killDaemon wait until the socket file is removed.
...
There is a race condition where the old daemon may remove the socket file
created by the new daemon.
2021-10-02 18:41:50 +01:00
Qi Xiao
56b2598284
pkg/daemon: Add util for testing the termination of server.
2021-10-02 16:02:05 +01:00
Qi Xiao
b801a99d2a
pkg/daemon: Test Activate killing outdated daemon.
2021-10-02 15:47:18 +01:00
Qi Xiao
ba3dccb625
pkg/sys: Clarify package godocs.
2021-10-02 13:45:47 +01:00
Qi Xiao
67369b6284
pkg/sys/unix: Simplify the handling of Termios differences a bit.
2021-10-02 13:42:27 +01:00
Qi Xiao
f9103bef1a
pkg/sys/unix: Remove utilities that are no longer needed.
2021-10-02 13:25:21 +01:00
Qi Xiao
7a72b6346a
Reorganize pkg/sys into portable and non-portable system utilities.
...
Non-portable ones are moved into new packages pkg/sys/e{unix windows}. The "e"
prefix is needed to avoid conflict with packages under golang.org/x/sys/ and can
mean "extra".
2021-10-02 13:14:00 +01:00
Qi Xiao
93f530b39d
pkg/daemon: Fix test when run as root.
2021-10-02 01:29:17 +01:00
Qi Xiao
bd285bd25c
pkg/daemon: Slightly improve the coverage of activate.go.
2021-10-02 01:21:21 +01:00
Qi Xiao
101576471b
pkg/daemon: Fix the handling of hanging sockets.
...
Also enable the test.
The implementation incorrectly assumed that trying to connect to a hanging
socket will return rpc.ErrShutdown; this is not actually the case.
Also change error wrapping in activate.go to use %w instead of %v to preserve
the wrapped error.
2021-10-01 23:56:57 +01:00
Qi Xiao
821a204fef
pkg/daemon: Test that Activate can remove hanging socket.
...
The test is currently skipped since the corresponding behavior has not been
implemented correctly.
2021-10-01 22:19:23 +01:00
Qi Xiao
fe0a8602d3
pkg/daemon: Test daemon spawning.
...
Also do some minor cleanup.
2021-10-01 21:54:15 +01:00
Qi Xiao
6e4296db2b
Make TestActivate_FailsIfCannotStatSock work on Windows.
2021-10-01 19:14:50 +01:00
Qi Xiao
e60fd50737
Only skip the test on Windows.
2021-10-01 00:38:06 +01:00
Qi Xiao
7f8ab450a5
Disable test that may have inadvertently triggered daemon spawning.
2021-10-01 00:32:32 +01:00
Qi Xiao
09e5ffe9d9
pkg/daemon: Improve the coverage of activate.go slightly.
...
Also remove an unused code branch.
2021-10-01 00:03:22 +01:00
Qi Xiao
7995cc5f6f
pkg/daemon: Add basic test for Activate.
2021-09-30 23:45:38 +01:00
Qi Xiao
8e117a2875
Merge pkg/daemon/client into pkg/daemon.
...
Also merge and rename files to make the client/server separation clearer.
2021-09-30 23:37:36 +01:00
Qi Xiao
025728b35d
pkg/daemon: Don't test any system signal behavior on Windows.
...
(*os.Process).Signal doesn't support sending SIGINT on Windows either.
2021-09-29 23:50:45 +01:00
Qi Xiao
fdd65538c6
pkg/daemon: Don't test SIGTERM on Windows.
...
Also don't block test indefinitely if server doesn't terminate.
2021-09-29 23:44:34 +01:00
Qi Xiao
3eedcf3c85
pkg/daemon: Increase coverage of serve.go.
2021-09-29 23:30:13 +01:00
Qi Xiao
cff34107da
pkg/daemon: Rewrite the main loop and make it easier to test.
2021-09-23 20:54:12 +01:00
Qi Xiao
ccc2750037
Remove the experimental web UI.
...
It has not been actively developed for a long time and has a vulnerability:
https://github.com/elves/elvish/security/advisories/GHSA-fpv6-f8jw-rc3r
2021-09-21 23:45:09 +01:00
Qi Xiao
a9f28832c4
pkg/parse: Improve coverage of quote.go.
2021-09-17 20:24:20 +01:00
Qi Xiao
9344aa9659
pkg/daemon/daemon_test.go: Disable TestProgram_StillServesIfCannotOpenDB now.
2021-09-15 21:37:28 +01:00
Qi Xiao
e046315d28
pkg/daemon/daemon_test.go: Return more detailed error from startClient.
2021-09-15 21:31:51 +01:00
Qi Xiao
7d5175e082
pkg/daemon: In tests, print error to stdout if server fails to start.
2021-09-15 21:12:26 +01:00
Qi Xiao
11d36554fe
pkg/daemon: Test that the daemon still serves if failing to open DB.
...
Also change Serve to not use the default server of net/rpc (which made it
impossible to call Serve multiple times), and return the exit code instead of
using os.Exit.
Also change service.Version to always succeed; this is necessary since
client.Activate uses this method to determine connection health.
2021-09-15 20:59:37 +01:00
Qi Xiao
418ae40ea9
pkg/eval/evaltest: Update godoc (TestCase -> Case).
2021-09-15 20:19:25 +01:00
Qi Xiao
73c269b98f
pkg/daemon: Do not use client.Activate in test to connect to server.
...
client.Active will try to spawn a new server if it cannot connect; this
is not desirable.
2021-09-12 23:53:08 +01:00
Qi Xiao
aa7e958704
pkg/daemon: Terminate test correctly if server did not come up.
2021-09-12 23:45:23 +01:00
Qi Xiao
3bd132b53e
pkg/daemon: Rewrite test to exercise the Program.
2021-09-12 23:18:37 +01:00
Qi Xiao
c9930a8ddf
pkg/store/storetest: Add test against CmdsWithSeq.
2021-09-12 22:23:22 +01:00
Qi Xiao
90d5d01cc5
pkg/eval/evaltest: Fix package godoc.
...
There was an empty line between the godoc and the package line by mistake.
2021-09-12 18:04:24 +01:00
Qi Xiao
be56f72729
pkg/testutil: Add utility for setting umask during tests.
2021-09-12 14:42:06 +01:00
Qi Xiao
e0b824bbdf
Improve coverage for "no suitable subprogram" error.
2021-09-12 14:23:29 +01:00
Qi Xiao
7ef7cb9f1b
pkg/eval/evaltest: Clean up godoc and some minor API details.
2021-09-12 14:13:18 +01:00
Qi Xiao
b6d69d0b30
pkg/prog/progtest: Rewrite the progtest API.
...
The progtest package now provides a declarative framework, modelled after
pkg/eval/evaltest. Tests that use progtest are now much more concise.
2021-09-12 14:06:05 +01:00
Qi Xiao
be3431bbbf
pkg/prog: Simplify the Program interface.
...
Instead of a separate ShouldRun method, use a special error value to signify
that a Program should not be run.
2021-09-12 00:40:35 +01:00
Qi Xiao
05a3251cd8
pkg/daemon: Use UNIX socket on Windows.
...
Windows 10 has supported UNIX sockets for a pretty long time
(https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ ).
Interestingly, os.Stat calls on UNIX socket files fail on Windows; only
os.Lstat calls work.
2021-09-11 22:05:06 +01:00
Qi Xiao
315a8b77e1
pkg/eval: Improve coverage of builtin_fn_container.go.
2021-09-11 14:51:26 +01:00
Qi Xiao
c07c26b4c7
pkg/eval/vals: Remove a duplicate test.
2021-09-11 13:57:53 +01:00
Qi Xiao
8c8a80ff52
Fix staticcheck error.
2021-09-11 02:58:54 +01:00
Qi Xiao
b36c9bf513
pkg/eval/vals: Improve coverage.
2021-09-11 02:54:34 +01:00
Qi Xiao
9ade639b38
pkg/cli/term: Improve coverage of reader_unix.go.
...
Also change error messages to start with lower case letters.
2021-09-10 20:53:02 +01:00
Qi Xiao
492ff19077
pkg/eval: Improve coverage of compile_lvalue.go.
2021-09-10 20:09:04 +01:00
Qi Xiao
276fe85bc3
pkg/eval: Improve coverage for builtin_fn_styled.go.
2021-09-10 19:39:20 +01:00
Qi Xiao
8713cb5b1c
pkg/eval: Slightly improve coverage of glob.go.
2021-09-10 19:08:22 +01:00
Qi Xiao
6b6d3d5a95
pkg/eval: Improve coverage of glob.go.
2021-09-10 18:57:11 +01:00
Qi Xiao
c3345eebc7
pkg/cli/lscolors: Fix test on Windows.
2021-09-10 01:10:23 +01:00
Qi Xiao
0f63524c97
pkg/cli/lscolors: Improve coverage of feature.go.
2021-09-10 01:02:31 +01:00
Qi Xiao
5fb6534cfe
pkg/cli/lscolors: Fix test on Windows.
2021-09-09 21:57:35 +01:00
Qi Xiao
232a605e93
pkg/cli/lscolors: Improve coverage of feature.go.
2021-09-09 21:53:25 +01:00