Qi Xiao
ed97664695
pkg/eval: Test the exit command by faking os.Exit.
2022-06-23 20:25:01 +01:00
Qi Xiao
e0292dd298
Get coverage on IsStructMap methods with a hack.
2022-06-20 22:08:19 +01:00
Qi Xiao
4afbb71c07
Move pkg/testutil/must.go to a new pkg/must.
2022-06-20 20:29:14 +01:00
Qi Xiao
d2c005df45
pkg/eval: Test import of module with invalid UTF-8.
2022-06-20 00:14:25 +01:00
Qi Xiao
786b679509
pkg/eval: Cover more tilde expansion errors.
2022-06-20 00:08:33 +01:00
Qi Xiao
6723b9a226
Use consistent pattern for mutating variables in tests.
...
- Use testutil.Set.
- Only export such variables to tests.
2022-06-19 23:56:18 +01:00
Qi Xiao
94e43cd2fd
pkg/eval: Add tests for errors in tilde expansion.
2022-06-19 23:34:36 +01:00
Qi Xiao
6a1e7b3996
pkg/shell: Add more daemon-related tests.
...
Also:
- Remove duplicate code for closing daemon client.
- Avoid using (*testing.T).TempDir - it uses test name in the path, which can
exceed the limit of the address when calling bind(2):
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_un.h.html#tag_13_6
7_04
2022-06-19 21:45:36 +01:00
Qi Xiao
75ee261fcb
pkg/eval: Remove access methods for exported fields.
...
The exported fields are intended to be mutated directly.
2022-06-18 19:01:59 +01:00
Qi Xiao
d48b6f1843
pkg/eval/vals: Replace MakeListFromStrings with a generic MakeListSlice.
2022-06-17 16:50:38 +01:00
Qi Xiao
ae9e6d1565
Fixup for #1531 .
...
- Fix the handling of actual occurrences of U+FFFD.
- Fix an existing bug of QuoteVariableName("$\n").
2022-06-11 21:26:32 +01:00
Kurtis Rader
d0f6858b95
Correctly encode strings with invalid UTF-8
...
In addition to fixing the encoding bugs standardize on \xNN notation for
bytes rather than \uNNNN; e.g., \x00 rather than \u0000.
Also, update the documentation for double-quoted strings to include the
\e sequence.
Fixes #1528
2022-06-11 20:42:06 +01:00
Qi Xiao
68bce3b4a4
Clarify error message when writing values to port not supporting it.
...
This fixes #1516 .
2022-06-07 20:29:34 +01:00
Qi Xiao
f42c2dda61
Make init value of $f~ actually identical to $nop~.
...
This fixes #1519 .
2022-06-07 20:20:00 +01:00
Qi Xiao
8b0c7fdb36
Fix some lint warnings found on Windows.
2022-06-05 22:01:16 +01:00
Qi Xiao
d4dd11a981
pkg/eval/vars: Deexport EnvVariable, use Unset/IsSet via interface
2022-06-05 21:47:51 +01:00
Qi Xiao
26a66284a9
Fixup for #1551 .
2022-06-05 16:01:10 +01:00
Tw
d27610b3e4
Fix undefined temporary environment restoring issue
...
Close #1536
Signed-off-by: Tw <tw19881113@gmail.com>
2022-06-05 15:41:19 +01:00
Kurtis Rader
71cd3835bc
Don't dot import pkg/tt
...
Qualified imports of pkg/tt outnumber unqualified (27 to 24). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.
2022-06-04 23:39:19 +01:00
Kurtis Rader
f681a73a1d
Don't dot import pkg/testutil
...
Qualified imports of pkg/testutil outnumber unqualified (55 to 7). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.
2022-06-04 23:39:19 +01:00
Kurtis Rader
14321f9e82
Make parse.Source naming more consistent
...
Fixes #1545
2022-05-29 17:36:29 +01:00
Kurtis Rader
7bae8f2df7
Correctly handle [..=-1] list indexing
...
Fixes #1518
2022-05-22 20:38:16 +01:00
Qi Xiao
a57275564b
Document relationship between *-env commands and E: namespace.
2022-05-22 20:13:17 +01:00
Qi Xiao
aa6d5a6257
Re-enable staticcheck, and fix issues it found.
2022-05-22 11:57:38 +01:00
Qi Xiao
dd3950cec0
Use the new testutil.Set in more places.
2022-04-11 21:55:59 +01:00
Qi Xiao
3a3b8f5700
pkg/edit/complete: Change Complete to take an Evaler.
...
The PureEvaler abstraction made things unnecessarily complex; it's better to
just create a real Evaler for tests is pretty.
The Evaler has a new ReplaceBuiltin method to make it easier to construct the
expected test result.
2022-04-11 21:39:29 +01:00
Qi Xiao
f8f60953ad
Properly deprecate float64.
...
- Replace its use with "num" in documentation and test code.
- Add a new "inexact-num" for explicitly converting a number to inexact.
This fixes #1513 .
2022-04-09 11:45:15 +01:00
Qi Xiao
6ec410753b
evaltest: Fix diff output.
2022-04-07 20:46:30 +01:00
Qi Xiao
51e4d97568
interface{} -> any now that Elvish requires Go 1.18.
2022-03-20 16:17:19 +00:00
Qi Xiao
f7cb556d9b
Require Go 1.18.
...
- Run "go fix" to remove legacy build tags
- Use staticcheck@master until it has a release that supports Go 1.18
- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00
Qi Xiao
957c8a7521
evaltest: Check that stderr is empty if PrintsStderrWith is not called.
...
Among other things, this will check for deprecation warnings. Also fix test code
that uses deprecated features.
2022-03-20 09:50:05 +00:00
Qi Xiao
5f1673c6c4
Use go-cmp to report unexpected test results.
...
cmp.Diff panics when comparing a struct that has unexported fields and no String
or Equal method, so change some structs to either export all their fields or
have an Equal method.
This fixes #1136 .
2022-03-11 22:49:32 +00:00
Qi Xiao
e894ae5f82
Improve the syntax of "try".
...
* Require at least one of "except" or "finally" to be present. This fixes #1424 .
* Rename "except" to "catch". The former will be deprecated from 0.18.0. This
addresses #1497 .
2022-03-01 13:57:00 +00:00
Qi Xiao
d7a9d38731
pkg/eval: Remove reference to the now-gone local: scope.
2022-02-20 23:30:47 +00:00
Qi Xiao
59459793e3
pkg/persistent: Cons -> Conj.
...
Cons was a misnomer for the operation of adding an element at the end of a
vector. Follow Clojure's naming here and call this operation Conj.
2022-01-05 22:34:55 +00:00
Qi Xiao
8ed351e386
Add a new "defer" command.
2022-01-05 00:12:35 +00:00
Qi Xiao
38d4553833
Update assignment syntax in docs.
...
- Also remove the section for the legacy assignment syntax.
- Also add a paragraph to "eval" about upvalues.
2022-01-03 19:45:39 +00:00
Qi Xiao
003557c22a
Remove support for the legacy lambda syntax.
...
This fixes #664 .
2022-01-03 00:47:41 +00:00
Qi Xiao
be1e144b45
Remove support for the "local:", "up:" and ":" special namespaces.
...
This fixes #1409 .
2022-01-03 00:47:41 +00:00
Qi Xiao
3dd3b780b9
Remove legacy assignment syntax.
...
This fixes #645 .
2022-01-03 00:47:41 +00:00
Qi Xiao
4fcffc5671
Remove most uses of the legacy assignment syntax.
...
The remaining few uses are in some of the tests, which will be removed later.
This addresses #645 .
2022-01-03 00:47:41 +00:00
Qi Xiao
653c9f9d0f
Remove dir-history, deprecated since 0.17.0.
2022-01-03 00:47:41 +00:00
Qi Xiao
3abf7f5510
Deprecate the legacy temporary assignment syntax from 0.18.0.
...
This addresses #1114 .
2022-01-03 00:47:24 +00:00
Qi Xiao
11de899040
Add fuzz test for (*eval.Evaler).Check.
2022-01-01 23:52:08 +00:00
Qi Xiao
ae91cf7b1c
Fix build on Go 1.16.
2021-12-31 21:13:41 +00:00
Qi Xiao
097e32b375
pkg/eval/vals: Add ReprPlain, Repr without pretty-printing.
...
Also de-export NoPretty now that it is no longer needed.
2021-12-31 21:05:07 +00:00
Qi Xiao
de3ac3166d
Add a new conversion utility vals.ScanMapToGo.
2021-12-31 18:00:36 +00:00
Qi Xiao
e134ef51e3
Handle all-cap abbreviations in strutil.CamelToDashed.
...
Also remove support for the "name" field tag from eval.scanOptions - it's not
used anywhere and the use case it was intended for is handled by CamelToDashed.
2021-12-31 16:54:32 +00:00
Qi Xiao
d9e14da0db
Export eval.Closure and (*eval.Frame).Fork.
2021-12-31 14:28:30 +00:00
Qi Xiao
4906c4aa28
Fix doc for the call builtin.
2021-12-31 12:46:47 +00:00