Commit Graph

438 Commits

Author SHA1 Message Date
Qi Xiao
6e75f3468c Move API of pkg/store into pkg/storedefs.
This makes the nodaemon entrypoint not depend on boltdb at all, reducing its
size by 100KB (on darwin-arm64).
2021-06-19 01:54:00 +01:00
Qi Xiao
cfb6134236 Remove daemon:spawn.
The daemon module has never been documented and is not used by any code on GitHub:
https://github.com/search?q=%22use+daemon%22+extension%3Aelv&type=Code&ref=advsearch&l=&l=
arch&l=&l=
2021-06-19 01:07:29 +01:00
Qi Xiao
27eec7c8ee Reorganize the daemon module.
* Move client, spawning and activation code into pkg/daemon/client.

* Move API types into pkg/daemon/daemondefs.
2021-06-19 01:06:11 +01:00
Qi Xiao
1fe1497c66 Add appropriate build tag on test for Unix-only exec command. 2021-06-15 20:28:49 +01:00
Qi Xiao
a70059aeb6 Test the exec builtin command. 2021-06-15 20:21:47 +01:00
Qi Xiao
3b7c18c6c5 pkg/eval/vals: Improve test coverage of index.go and iterate_keys.go.
This addresses #1234.
2021-06-15 19:22:58 +01:00
Qi Xiao
2e9e0289cc Make the kind of int, *big.Int and *big.Rat "number". 2021-06-15 19:22:38 +01:00
Qi Xiao
3f0e89d223 pkg/eval/vals: Test expected panics in num.go. 2021-06-15 19:11:57 +01:00
Qi Xiao
2093ac680f Increase coverage of pkg/eval/vals/index_list.go to 100%.
This addresses #1234.
2021-06-15 18:53:31 +01:00
Qi Xiao
83c81cc5b2 Fix unused symbols found by staticcheck.
Also consolidate pkg/sys/testutil_test.go into pkg/sys/select_test.go.
2021-06-15 17:46:31 +01:00
Qi Xiao
5cbb218dad Merge branch 'docset' 2021-06-14 22:50:00 +01:00
Qi Xiao
7d435154f5 Move doc for the epm module into its source. 2021-06-14 22:48:10 +01:00
Qi Xiao
56ce36f1aa Fix the file module's elvdoc.
- Fix broken anchors.

- Fix broken comment block of the pipe command.
2021-06-14 22:18:32 +01:00
Qi Xiao
162ae65b92 Fix elvdoc for file:close and platform:hostname. 2021-06-14 21:57:57 +01:00
Qi Xiao
3204e700ac Fixup for #1329 2021-06-13 22:54:47 +01:00
Kurtis Rader
9a576529a3 Replace ErrArgs with more specific errors
This also replaces the slightly awkward "arguments here" reason with
"argument count" as the "what" for a typical errs.ArityMismatch
exception. It also reformats most of the constructors so that the "what"
is on the same line. This makes `grep errs.ArityMismatch **.go` more
useful as a result.
2021-06-13 22:42:04 +01:00
Qi Xiao
a823eb8fbb Fix a broken link. 2021-06-13 16:27:36 +01:00
Qi Xiao
3e9e7ce5c8 In elvdoc for to-terminated, use slurp to show byte output that includes NUL. 2021-06-11 14:49:43 +01:00
Qi Xiao
46fa331dca Fixup for #1308. 2021-06-10 09:14:15 +01:00
Kurtis Rader
267e015bd6 Add from-terminated and to-terminated commands
This change makes feeding output to commands which handle NUL terminated
"lines" (e.g., `fzf -read0` or `xargs -0`) extremely fast compared to
using an explicit Elvish loop that does `print $val"\x00"`. Similarly for
handling input from commands that produce NUL terminated "lines" (e.g.,
`find . -print0`) compared to an Elvish loop using `read-upto "\x00"`.

Resolves #1070
Related #1053
2021-06-10 09:06:15 +01:00
Qi Xiao
af3292418f Change math:pow to produce exact results in certain cases; deprecate math:pow10. 2021-06-10 01:47:59 +01:00
Qi Xiao
59e4a7302a Remove outdated TODO on math:round. 2021-06-10 00:11:52 +01:00
Qi Xiao
b7f2457820 Make all rounding functions in math: exactness-preserving.
This fixes #1331.
2021-06-10 00:10:50 +01:00
Qi Xiao
cb15a1e28e Fixup for #1332 2021-06-06 22:46:27 +01:00
Kurtis Rader
b8bc076d07 Increase pkg/eval/vars/env_list.go coverage to 100%
Related #1234
2021-06-06 22:43:45 +01:00
Kurtis Rader
a55b83c6f2 Increase pkg/eval/vars/env.go coverage to 100%
Related #1234
2021-06-06 22:39:09 +01:00
Qi Xiao
59b96f27d8
Merge branch 'master' into testutil-test-coverage 2021-06-06 22:03:34 +01:00
Qi Xiao
675812c608 Fixup for #1321. 2021-06-06 22:01:41 +01:00
Qi Xiao
79b5435f8a
Merge pull request #1321 from krader1961/sleep-values
Fix `sleep` handling of the new `num` type
2021-06-06 22:00:47 +01:00
Qi Xiao
c3594f0670 Fixup for #1322. 2021-06-06 21:59:30 +01:00
Kurtis Rader
3a73babdee Increase eawk test coverage to 100%
Related #1234
2021-06-06 21:56:23 +01:00
Qi Xiao
16dc290775
Merge branch 'master' into sleep-values 2021-06-06 21:52:27 +01:00
Qi Xiao
3cf5ab996f pkg/eval/vals: Make Pipe a PseudoStructMap.
It is in theory better implemented as a StructMap because it is a transparent
data type. However, the reflection-based algorithm for StructMap will create a
"kind" field for it, and we don't want to remove the custom kind of Pipe yet, so
this has to be a PseudoStructMap now.
2021-06-06 21:48:39 +01:00
Qi Xiao
a69ce8461e
Merge branch 'master' into pipe-close 2021-06-06 21:40:35 +01:00
Kurtis Rader
ff9341eb91 More error deduplication 2021-06-06 14:54:47 +01:00
Kurtis Rader
f5d38ab3d7 Eliminate duplicate error definitions
In light of the preceding change to address staticcheck lint warnings I
ran this:

    grep 'errors\.New("' **.go |
        sed -e 's/^.*errors\.New("\([^"]*\)".*/\1/' |
        sort | uniq -c | sort -n

Which caused me to notice two errors associated with the builtin `sleep`
command have multiple definitions. It is questionable whether the negative
duration error is justified. I think it should be replaced by the invalid
duration error but decided not to do that in order to limit the scope of
this change.
2021-06-06 14:54:47 +01:00
Kurtis Rader
9345125bd2 staticcheck lint cleanups
Fix two issues found by `staticcheck -tests=false ./...`:

pkg/eval/go_fn.go:155:5: var errNoOptions is unused (U1000)
pkg/persistent/hashmap/hashmap.go:321:2: only the first constant in this group has an explicit type (SA9004)
2021-06-06 14:54:47 +01:00
Kurtis Rader
2b6b11c230 Exercise testutil.MustPipe
I noticed that testutil.MustPipe was not covered by any unit tests. This
converts the handful of places that should use it to do so. This changes
the coverage of pkg/testutil/must.go from 61.5% to 73.1%. There isn't
any way to increase that further without explicitly testing the panic
paths.
2021-06-02 20:29:34 -07:00
Qi Xiao
9361832251 Fixup for #1310 2021-05-31 22:13:24 +01:00
Qi Xiao
641690ed45
Merge branch 'master' into peach-unit-test 2021-05-31 21:33:10 +01:00
Qi Xiao
c39d03e973 Support all number types in the order command.
This fixes #1309.
2021-05-31 21:25:08 +01:00
Qi Xiao
8a2c9a24db pkg/eval/vals: Add an optimized version of UnifyNums for two numbers. 2021-05-31 21:02:12 +01:00
Kurtis Rader
20decc5976 Implement edit:command-history &dedup
This implements `&dedup` and `&newest-first` options for
`edit:command-history`. This makes it noticably cheaper to feed unique
command history into external commands like `fzf`.

Related #1053
Fixes #568
2021-05-30 23:49:46 +01:00
Kurtis Rader
f67c7ed387 A couple of TODO cleanups 2021-05-30 00:40:42 +01:00
Kurtis Rader
9b61cdc727 Be consistent about sync.WaitGroup var naming
Also, remove the unused dbStore.Waits() method. This came to my
attention while writing `peach` unit tests.
2021-05-30 00:40:42 +01:00
Qi Xiao
cc1a07b28b Fixup for file:truncate. 2021-05-30 00:32:30 +01:00
Supreet
fc28dddb38 file:truncate added to file module, with requested changes 2021-05-30 00:15:43 +01:00
Kurtis Rader
956c4c9d8f Fix sleep handling of the new num type
Fixes #1317
2021-05-23 20:17:51 -07:00
Kurtis Rader
3ded2fb772 Replace prclose and pwclose with file:close
Rather than having specialized commands make a `file:pipe` object
indexable so we can use the generic `file:close` command. This does not
address existing problems; such as builtins not failing when writing to
a `file:pipe` object if the read-end is closed.

Related #1316
2021-05-22 20:55:53 -07:00
Kurtis Rader
8a92716bd9 Add test coverage of peach
This also documents the behavior of `break` and `continue` when used in
the function passed to `peach`.

Related #1234
2021-05-17 19:28:45 -07:00