Commit Graph

5535 Commits

Author SHA1 Message Date
Qi Xiao
78ac59cbfc Update some comments in Makefile. 2021-06-09 01:11:09 +01:00
Qi Xiao
7d2130141b Make gofmt -s part of checkstyle-go.sh and the style target in Makefile.
Also fix the comment in checkstyle-go.sh, it got the behavior of go{imports fmt}
-d the other way around.
2021-06-09 01:06:00 +01:00
Qi Xiao
49257cb9fe Run gofmt -s 2021-06-09 01:01:09 +01:00
Qi Xiao
d81bfa69f0 Fix handling of Windows in TestGlob_InvalidUTF8InFilename. 2021-06-09 00:57:36 +01:00
Qi Xiao
3f3ea34bc2 Document that #1220 is fixed in release notes for 0.16.0. 2021-06-09 00:47:51 +01:00
Qi Xiao
e061b657cb Merge branch 'b1220' 2021-06-09 00:43:19 +01:00
Qi Xiao
bcaa8f5cbf Actually make the test reproduce the crash described in #1220.
The crash doesn't happen right now because the code has been fixed, but the test will
reproduce the crash if the change in glob.go is reverted.
2021-06-09 00:40:55 +01:00
Qi Xiao
941cdf2cdf Fix crash when globbing files with invalid UTF-8 sequences.
This fixes #1220.
2021-06-09 00:36:45 +01:00
Qi Xiao
246c4741c2 Also skip the test if the OS creates the file but mangles the name. 2021-06-09 00:36:18 +01:00
Qi Xiao
e9bcb737ab Make test case crashing too. 2021-06-09 00:31:26 +01:00
Qi Xiao
cfc8f0fe69 Add (failing) regression test for #1220. 2021-06-09 00:10:12 +01:00
Qi Xiao
01b79863da Fix URL to goreportcard badge 2021-06-08 23:02:36 +01:00
Manuel Mendez
25a5c78bf5 Fix oldest command being ignored in edit:command-history &dedup
The loop iteration was stopping at i == 0 and so allCmds[0] was never
examined.
2021-06-08 05:05:18 +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
201fcc009a Makefile: Change the "get" target to use "go build".
The target defauls to $GOPATH/bin/elvish to emulate the behavior of "go get",
but can be overriden by the ELVISH_MAKE_BIN environment variable.
2021-06-06 22:29:30 +01:00
Qi Xiao
e332c66f08
Merge pull request #1325 from krader1961/testutil-test-coverage
Exercise testutil.MustPipe
2021-06-06 22:03:41 +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
e4afb55bfb
Merge pull request #1320 from krader1961/pipe-close
Replace `prclose` and `pwclose` with `file:close`
2021-06-06 21:42:13 +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
Qi Xiao
69e9130cf5 pkg/glob: Update TODO about path separator on Windows. 2021-06-06 14:36:38 +01:00
Kurtis Rader
181b663c6a Fix isDrive
I was looking at "TODO" comments that could be eliminated and noticed the
one preceding the sole use of `isDrive()`. Which caused me to notice its
implementation is broken. The `s[1] < 'z'` test should be `s[0] < 'z'`
2021-06-06 14:34:23 +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
45fe3ac2c8
Merge pull request #1310 from krader1961/peach-unit-test
Add test coverage of `peach`
2021-05-31 21:49:24 +01:00
Qi Xiao
e142c6b6a0 Suppress SA2001 for genuine use of empty critical section. 2021-05-31 21:37:26 +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
7026c22c29 Ignore any file called "cover". 2021-05-31 21:24:59 +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
Qi Xiao
e69cde20dc pkg/store: Set options for temp store to improve performance. 2021-05-31 00:19:17 +01:00
Qi Xiao
09a911f2fa Fixup for #1307. 2021-05-31 00:10:26 +01:00
Kurtis Rader
4186e0e77f Add a &cmd-only option to edit:command-history
This is useful when piping the output into a program like `fzf` and more
efficient than dealing with the map. This takes 180.32 ms on my system
(best of five runs):

```
time { edit:command-history &dedup &newest-first | each [hist-entry]{ print $hist-entry[cmd]"\000" } >/dev/null }
```

This option reduces the time to 156.12 ms:

```
time { edit:command-history &dedup &newest-first &cmd-only | each [cmd]{ print $cmd"\000" } >/dev/null }
```

It's not a huge difference but is 13% faster, and should be considerably
faster when combined with a hypothetical `to-lines &null` option I intend
to implement.

Related #1053
2021-05-30 23:49:46 +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
Qi Xiao
e44b677e79 Switch IRC channel to Libera Chat. 2021-05-30 14:14:38 +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
Kurtis Rader
fee2870564 Lint cleanup: avoid dangling "else { return }"
Also, don't assume the only possible pointer sizes are four and eight bytes.
2021-05-30 00:38:26 +01:00
Qi Xiao
ab09c81cc5 Tweak example for using variable defined by fn. 2021-05-30 00:37:29 +01:00
Manuel Mendez
69d82037bd Add an example of using fn created variable for function name
I was trying to add a `fn` created function to a list but was unable to
get it working. I suspected using just `name` wasn't correct and tried
`$name` and other attempts but was not successful. Finally was pointed to
`$name~` by @krader1961. I was able to find where this was documented in the
spec, but I missed it since it was just one line at the bottom of the section.
I think an example would have called out the special variable name better and
is just good to have anyway.
2021-05-30 00:36:34 +01:00