Commit Graph

694 Commits

Author SHA1 Message Date
Kurtis Rader
6d405cb191
Document the str: module and add unit tests (#928)
* Tiny step to documenting the str: module

* Document another block of str: functions

* Document another block of str: functions

* Document another block of str: functions

* Add str: unit tests

* Address review feedback

* Address PR review feedback
2020-03-19 09:24:56 +00:00
Qi Xiao
88ccec5475 pkg/eval/vals: Use the same algorithm as ToString in the Repr of float numbers. 2020-02-02 16:10:41 +00:00
Qi Xiao
41985123d3 Move all docs for builtins to the Go code. 2020-01-18 08:12:50 -05:00
Qi Xiao
feadbc2330 Introduce a new "one" builtin. 2020-01-17 09:00:23 -05:00
Qi Xiao
8a8db45230 pkg/eval: Make all take an optional argument.
Also make `all` no longer preserve byte inputs but turn them into values.
2020-01-17 08:45:34 -05:00
Qi Xiao
a3adcbf11e Add a test for #754.
The test now fails with "go test -race".
2020-01-14 08:13:49 -05:00
Qi Xiao
6d4abe1666 pkg/eval: Handle ~username/* correctly.
This fixes #793.
2020-01-14 08:03:41 -05:00
Qi Xiao
570bf0f42a pkg/eval: Factor all exception logic to (*Frame).makeException. 2020-01-12 18:00:45 -05:00
Qi Xiao
1788c13489 pkg/eval: Do not catch exceptions from panics in Evaler.
Nowhere uses this mechanism now. Delete the util in pkg/util.

This fixes #570.
2020-01-12 17:57:27 -05:00
Qi Xiao
4ef43e0bde pkg/eval: Inline the use of util.{Throw,Catch} in the compiler. 2020-01-12 17:55:17 -05:00
Qi Xiao
06f9a2fdbe pkg/eval: Add test to reveal data races in Evaler. 2020-01-12 16:52:12 -05:00
Qi Xiao
0d58fea6fd pkg/eval/vals: Further refine the float printing algorithm.
This fixes #811 (for real).
2020-01-12 11:11:47 -05:00
Qi Xiao
9ad6eba476 pkg/eval/vals: Print floats with exponents between -4 and 13 with %f.
This fixes #811.
2020-01-12 10:28:31 -05:00
Qi Xiao
4fb04bc27a pkg/eval: Catch index write access to nonexistent variables.
This fixes #889.
2020-01-12 08:23:37 -05:00
Qi Xiao
2e74150dda pkg/eval: Add more test for variable use. 2020-01-12 12:39:25 +00:00
Qi Xiao
6189fd372f Fix crash when running external command with port table nil values.
This fixes #788 (for real; a regression test has been added).
2020-01-12 12:32:25 +00:00
Qi Xiao
5550819ac0 pkg/eval: Check FD when using it as redir source.
This fixes #788.
2020-01-12 00:42:18 +00:00
Qi Xiao
64b104f533 Support dynamic command names for unambiguous external commands.
This fixes #764.
2020-01-11 18:57:39 +00:00
Qi Xiao
b3a48ed510 pkg/eval: Revamp Source. 2020-01-11 03:01:30 +00:00
Qi Xiao
433b5f2d96 pkg/eval: Lift the restriction of relative "use" from scripts. 2020-01-11 02:27:43 +00:00
Qi Xiao
8cf6cc0747 pkg/eval: Add test for background job. 2020-01-08 23:29:00 +00:00
Qi Xiao
b1deb03234 pkg/eval: More tests. 2020-01-08 23:21:36 +00:00
Qi Xiao
12b396d8c4 pkg/eval: Support testing that a piece of code does not compile. 2020-01-08 23:09:41 +00:00
Qi Xiao
ca945dcb7f pkg/eval: TestCase.Errors{With,} -> Throws{,Any}.
This is in preparation for supporting compilation errors. Also did some
cleanups.
2020-01-08 23:09:19 +00:00
Qi Xiao
8c0c6d182b pkg/eval/vals: More tests. 2020-01-08 10:32:51 +00:00
Qi Xiao
2d609bd5b4 pkg/eval/vals: Add methods to ValueTester; use it to test StructMap. 2020-01-08 10:20:43 +00:00
Qi Xiao
d19b9c5ab7 pkg/eval/vals: Change TestValue to a method-style API. 2020-01-07 09:58:49 +00:00
Qi Xiao
3cbbe120aa pkg/eval/vals: Add TestValue, and use it to test Pipe. 2020-01-06 23:51:55 +00:00
Qi Xiao
0bb6088790 pkg/eval/vals: eq -> Eq. 2020-01-06 23:28:23 +00:00
Qi Xiao
b8513f75b3 pkg/eval/vals: Move the "any" matcher to pkg/tt. 2020-01-06 23:19:00 +00:00
Qi Xiao
843e7f3d99 pkg/eval/vals: Do dot-imports from pkg/tt. 2020-01-06 23:14:51 +00:00
Qi Xiao
a8950535eb pkg/eval/vals: Always return structured errors.
Also match errors accurately in tests.
2020-01-06 23:02:26 +00:00
Qi Xiao
b496591e7c pkg/eval: Slightly simplify implementation of fopen. 2020-01-06 22:17:48 +00:00
Qi Xiao
10b4baf89c pkg/eval: NewInternalSource -> NewInternalGoSource. 2020-01-05 14:07:03 +00:00
Qi Xiao
44f266f92c pkg/eval: De-export SrcType. 2020-01-05 13:54:08 +00:00
Qi Xiao
2d8a045cf1 pkg/{eval,runtime}: Introduce a basic math module. 2020-01-04 17:24:00 +00:00
Qi Xiao
3de813c21c pkg/eval/vals: Check float64 indicies.
This fixes #852.
2020-01-02 23:03:26 +00:00
Qi Xiao
e9a8d1be91 pkg/edit: Support a &full flag in edit:redraw.
Also use it in readline-binding. This fixes #883.
2019-12-30 23:45:30 +00:00
Qi Xiao
770904b2c0 pkg/eval: Introduce new builtin read-upto for reading up to a byte.
This fixes #831.
2019-12-30 23:11:41 +00:00
Qi Xiao
83d1e95aa1 pkg/eval: Simplify Test with subtests. 2019-12-30 23:08:48 +00:00
Qi Xiao
6b876e559d pkg/store: Interface -> Store. 2019-12-26 18:09:26 +00:00
Qi Xiao
cbe0e3e7e7 Merge pkg/store/storedefs into pkg/store. 2019-12-26 18:05:13 +00:00
Qi Xiao
012b779ca7 pkg/daemon: Make Client an interface. 2019-12-26 17:23:18 +00:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00