Commit Graph

514 Commits

Author SHA1 Message Date
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
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
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
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
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
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
418ae40ea9 pkg/eval/evaltest: Update godoc (TestCase -> Case). 2021-09-15 20:19:25 +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
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
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
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
47de83c7d1 Reorganize standard library modules.
- Move from pkg/eval/mods to pkg/mods

- Introduce mods.AddTo that adds all standard library modules

- Move epm and readline-binding into their own packages
2021-08-24 15:56:04 +01:00
Qi Xiao
e83640bce1 Fix mods/path test on Windows. 2021-08-23 00:46:43 +01:00
Qi Xiao
9076934395 Remove most uses of the ioutil package.
https://golang.org/doc/go1.16#ioutil
2021-08-23 00:36:26 +01:00
Qi Xiao
7fa09ac1d3 Use buffered channels with signal.Notify.
Both places act on the first signal received, so a buffer size of 1 is
sufficient.
2021-08-23 00:22:11 +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
4d62732ebc Fix "indicies" -> indices. 2021-08-22 23:31:26 +01:00
Shengjing Zhu
5724ec4c47 Fix typos and add codespell to CI 2021-08-22 23:07:34 +01:00
Qi Xiao
92cb68fb32 Fix mods/path test on Go 1.17.
The TempDir and TempFile functions now return filenames starting with "./" when
the directory is ".".
2021-08-19 11:21:23 +01:00
Qi Xiao
437da2894e Fix epm lib path on Windows, and document the install paths. 2021-08-16 21:14:11 +01:00
Kolby Crouch
ba156db4d6 epm: fix for xdg-dir 2021-08-16 20:58:45 +01:00
Qi Xiao
1cc3faa15a Make use of (*testing.T).Cleanup in more places. 2021-08-06 23:49:11 +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
e035930e49 Merge branch 'master' into xdg-dir 2021-08-05 22:36:53 +01:00
Qi Xiao
d8ff3e743e pkg/eval: Fill in default dummy ports in Evaler.prepareFrame.
Also fix the value of Frame.port in a benchmark.

This fixes #1355.
2021-08-01 21:38:30 +01:00
Kurtis Rader
57cf018e06 Update unit tests that use p[rw]close
Replaces uses of the deprecated builtin `prclose` and `pwclose` commands
with `file close` in unit tests.

This also fixes one test that was not verifying what it intended due to
it's use of `.Throws(AnyError)` which was matching an Elvish error caused
by invalid command `file:prclose $p`.
2021-08-01 21:17:02 +01:00
Kurtis Rader
2e94e3bf87 Update run-parallel example
Courtesy of @zzamboni this updates the example of how to use the
`run-parallel` command to capture the stdout and stderr byte streams
independent of each other.

Resolves #1357
2021-08-01 21:12:17 +01:00
Kurtis Rader
659bd5fa68 unix:umask should accept int number type
Fixes #1356
2021-07-12 20:38:22 +01:00
Qi Xiao
2d09e1a500 Implement XDG directory support.
Tests will be added in a followup commit before this branch is merged.

This addresses #383.
2021-07-10 02:20:59 +01:00
Qi Xiao
d15218f11e Fixup for #1354. 2021-07-07 23:25:01 +01:00
Kurtis Rader
85c499f110 Lint cleanups
This change addresses issues reported by the `staticcheck` tool and a
couple reported by the `golint` tool. It also adds missing issue links
to a couple of entries in the release notes. This change deliberately
does not address these warnings since it is unclear whether the project
owner would prefer to suppress or address them:

    pkg/store/cmd.go:8:2: should not use dot imports (ST1001)
    pkg/store/db_store.go:10:2: should not use dot imports (ST1001)
    pkg/store/dir.go:8:2: should not use dot imports (ST1001)
2021-07-07 23:21:02 +01:00
Qi Xiao
00c7205e81 Fixup for #1348. 2021-07-03 20:34:56 +01:00