Commit Graph

30 Commits

Author SHA1 Message Date
Qi Xiao
6e36058d0a pkg/tt: Improve API.
- Use reflection to derive function name.

- Take test cases as variadic arguments, instead of requiring them to be wrapped
  in a Table.

- Support naming test cases.

- Run test cases as subtests with t.Run.
2024-01-11 15:42:43 +00:00
Qi Xiao
de3a7fd1b3 Standardize spelling: UNIX -> Unix.
https://en.wikipedia.org/wiki/Unix#Branding contains a history of the spelling.
Follow Wikipedia in using Unix instead of UNIX.
2023-01-04 18:09:11 +00:00
Qi Xiao
3847235a14 pkg/diag: Split Errors into another package.
The Errors function is not related to diag.Error, so keeping it in the same
package is confusing.

Also unexport the MultiError type. This allows its Error method to be
simplified, as it can assume that it always contains at least 2 errors.
2022-11-29 22:13:02 +00: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
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +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
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
71e5bff8da Replace direct reference to persistent types with their aliases in eval/vals. 2021-12-17 00:21:20 +00:00
Qi Xiao
6a92571a23 Check assignments to read-only variable during compilation. 2021-10-13 23:57:14 +01:00
Qi Xiao
492ff19077 pkg/eval: Improve coverage of compile_lvalue.go. 2021-09-10 20:09:04 +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
91b6f6dd72 Use the integrated persistent package. 2021-05-03 22:17:46 +01:00
Qi Xiao
9cd90c49bb Minor fixup for #1274. 2021-05-02 00:22:28 +01:00
Qi Xiao
82f1912c5e
Merge branch 'master' into readonly-var-msg 2021-05-01 19:06:39 -04:00
Qi Xiao
da67ba8a4a Use machine word (int) instead of int64 for fixnum. 2021-04-04 13:37:38 +01:00
Qi Xiao
4612b58759 Support exact integer and rational numbers. 2021-04-04 00:58:53 +01:00
Kurtis Rader
1e0885310e Include name in error msg setting a readonly var
When attempting to update a read-only var return an error struct rather
than a simple string (i.e., a Go `error` type).  This makes it possible
to include the var name in the error message.  This builds on commit
a33ecb2d that highlights the offending var name in the stack trace but
does not include the var name in the error message. With this change the
error message includes the offending var name.

Related #255
2021-03-26 18:38:22 -07:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
6e8ecc8bd5 pkg/eval: Cleanups for reducing the API surface area number of files.
- Move NewEnvListVar to pkg/eval/vars.

- De-export GlobPattern, GlobFlag and ExternalCmd.

- Merge editor.go and chdir.go into eval.go, value_helper.go into compile_value.go.

- Remove eval_internal_test.go and replace it with a new test for $pid.
2021-01-05 04:33:52 +00:00
Kurtis Rader
9c7c9cf7d9 [cleanup] trivial golint suggested changes
As with commit #eb2a792 I acknowledge that `golint` recommendations are
controversial and should not automatically be acted on. Nonetheless,
this change fixes legitimate lint issues such as copy/paste cleanups,
style problems I introduced (`i += 1` versus `i++`) or method/var comments
that are not in the preferred form.
2020-12-25 01:11:33 +00:00
Shengjing Zhu
6c08de0ff3 Fix typos found by codespell 2020-10-10 22:47:50 +01:00
Qi Xiao
5ec11cfe2b Update docs for $_ and $nil. 2020-09-04 22:45:04 +01:00
Kurtis Rader
28798ac053 Convert "XXX" to "TODO" comments
I stumbled across a comment that began with "XXX". It was clearly meant as
a "TODO" comment. This changes all such occurrences. However, a few "XXX"
comments are ambiguous and a better prefix might be "WARNING". The "TODO"
prefix at least ensures someone, eventually, looks into the situation
and either rewords the comment or fixes the problem. This change means
everyone can assume searching for "// TODO" will find all such comments
rather than requiring they also know to search for "// XXX".
2020-08-16 16:29:34 +01:00
Qi Xiao
6597d38834 pkg/eval: Test more error cases. 2020-04-13 16:29:01 +01:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00