Commit Graph

249 Commits

Author SHA1 Message Date
Qi Xiao
78cae6a695 pkg/prog/{shell,web} -> pkg/{shell,web}. 2020-04-25 00:12:18 +01:00
Qi Xiao
928949077b pkg/prog: Move all Program implementations into own packages.
This fixes #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
5b88057c94 pkg/prog: Remove Main; expose Run.
This is to prepare moving all the Program implementations into their respective
packages.

This addresses #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
be471ec761 pkg/program -> pkg/prog. 2020-04-25 00:12:18 +01:00
Qi Xiao
f209ffc7c4 pkg/program: Rewrite test with progtest. 2020-04-25 00:12:18 +01:00
Qi Xiao
be0502368d pkg/program/progtest: New package for program test utilities.
The code is inherited from the test fixture code in pkg/program/shell.
2020-04-25 00:12:18 +01:00
Kurtis Rader
4bfb6e2aad Fix how [ctrl-v] works on BSD systems
On BSD systems iexten has to be explicitly disabled. Whereas on Linux
systems it is implicitly ignored if icanon is disabled.

Fixes #917
2020-04-24 21:41:35 +01:00
Qi Xiao
17419d1ca3 pkg/program: Refactor the subprogram API.
This is in preparation for #985.
2020-04-24 20:30:04 +01:00
Qi Xiao
6938c8d117 pkg/program/shell: Increment $E:SHLVL.
This fixes #834.
2020-04-20 00:09:18 +01:00
Qi Xiao
28a7ca5a15 Document read-upto.
This fixes #938.
2020-04-19 14:28:37 +01:00
Qi Xiao
5cdff82883 pkg/eval: Fix stack trace, and add tests. 2020-04-18 00:28:48 +01:00
Kurtis Rader
ab3e7d6169 Implement the three inverse hyperbolic functions
Related #727
2020-04-17 22:08:17 +01:00
Qi Xiao
9869557aee pkg/eval: Add a few tests for builtin string functions.
This addresses #944.
2020-04-17 01:15:45 +01:00
Qi Xiao
cfe6fc2cab pkg/program/shell: Only run the daemon connection test on Unix. 2020-04-17 00:59:58 +01:00
Qi Xiao
e8368127b7 pkg/eval: Add more tests against glob.go.
This addresses #944.
2020-04-17 00:47:00 +01:00
Qi Xiao
fbc18ba55d pkg/eval: Rewrite glob tests. 2020-04-17 00:40:47 +01:00
Qi Xiao
c9458344f1 pkg/eval: Remove unneeded methods of GlobPattern. 2020-04-17 00:20:30 +01:00
Qi Xiao
dc564dbffb pkg/parse: Add more test against error cases in parse.go.
Also clean up a few small historical artifacts in parse.go.
2020-04-17 00:14:10 +01:00
Qi Xiao
ba554bfc1e pkg/parse: Make TestParseError much more rigorous. 2020-04-16 23:19:23 +01:00
Qi Xiao
224a0df825 pkg/parse: Remove ExitusNode.
This construct is no longer compiled or evaluated.
2020-04-16 22:29:49 +01:00
Qi Xiao
96f6738720 pkg/program/shell: Improve test for interact.go.
This addresses #944.
2020-04-16 22:02:05 +01:00
Qi Xiao
0475a0abbc pkg/program/shell: Test basic daemon connection logic.
This addresses #944.
2020-04-16 21:48:56 +01:00
Qi Xiao
382bd087f0 pkg/program/shell: More tests for paths.go.
This addresses #944.
2020-04-16 21:25:30 +01:00
Qi Xiao
b82ef67d1a Fix build 🤦 2020-04-16 16:49:54 +01:00
Qi Xiao
0f3853b78c pkg/program/shell: Add basic tests against MakePaths. 2020-04-16 16:46:23 +01:00
Qi Xiao
a2a42e2767 pkg/program/shell: MakePathsWithDefaults -> MakePaths.
Also change it to accept and return Paths values (instead of *Paths).
2020-04-16 16:46:23 +01:00
Kurtis Rader
094a03ac5b Normalize count implementation arity exception
Add some comments that clarify why the `count` implmentation does not
use the `Inputs` API. Change the mismatched arg count exception to match
that of the `Inputs` API. Add a couple more unit tests.

Resolves #966
2020-04-16 15:56:20 +01:00
Qi Xiao
e23c622863 pkg/program/shell: Test against Interact.
This addresses #944.
2020-04-16 11:41:34 +01:00
Qi Xiao
8deec2e3fe pkg/program/shell: Simplify test fixture. 2020-04-16 11:34:35 +01:00
Qi Xiao
4ef3782901 pkg/program/shell: More tests against script.go
This addresses #944.
2020-04-16 01:12:59 +01:00
Qi Xiao
317a2984a6 pkg/program/shell: Do not depend on IO redirection in test.
Since standard streams are no longer implicitly depended on, we can now fully
control the input and output streams, so use pipes for testing instead.
2020-04-16 00:49:22 +01:00
Qi Xiao
0c50e93ebd pkg/eval: Remove (*Evaler).EvalInTTY.
This is so that pkg/program/shell can get rid of the dependency on the standard
streams and can dependency-inject the files.
2020-04-16 00:11:23 +01:00
Qi Xiao
b1d9efbe47 pkg/eval: Tighten the type of Frame.intCh. 2020-04-15 23:03:58 +01:00
Qi Xiao
a99d930424 pkg/eval: Add test for source.go.
Also fix a small bug in printing internal Elvish sources.

This addresses #944.
2020-04-15 00:47:35 +01:00
Qi Xiao
8292a5b166 pkg/eval: Remove Evaler.EvalSourceInTTY. 2020-04-15 00:04:23 +01:00
Kurtis Rader
60fa63c383 Implement inverse trigonometric math functions
Related #727
2020-04-14 23:59:11 +01:00
Kurtis Rader
9b1c2783a7 Implement hyperbolic trigonometric math functions
Related #727
2020-04-14 23:58:10 +01:00
Kurtis Rader
2c6a90601c Fix two typos in my previous change 2020-04-14 23:57:33 +01:00
Qi Xiao
d77ad829b6 pkg/eval: Add Evaler.ParseAndCompile.
Also require a name argument in NewInteractiveSource.
2020-04-14 23:54:45 +01:00
Qi Xiao
a29f76c4ca pkg/program/shell: Add a minimal test against Script. 2020-04-14 23:09:34 +01:00
Qi Xiao
dd27bc4c20 pkg/program/shell: Refactor the API.
The package now exposes a Script and Interact method; the Shell type is moved
into pkg/program. This way this package deal with less command-line handling
logic and is nicer to test.
2020-04-14 23:03:45 +01:00
Qi Xiao
1c8af687fe pkg/diag: Do not depend implicitly on os.Stderr. 2020-04-14 22:35:02 +01:00
Qi Xiao
184b0c9828 pkg/program/shell: Use a more reliable way to prevent mkdir.
Also check that the return value is actually a directory in getSecureRunDir.
2020-04-14 22:02:03 +01:00
Qi Xiao
7b4f7c774d pkg/program/shell: Consolidate path handling into a Paths type. 2020-04-14 22:02:00 +01:00
Qi Xiao
3a976ef1c2 pkg/program/shell: Simplify getSecureRunDir and its tests. 2020-04-13 19:12:03 +01:00
Qi Xiao
6597d38834 pkg/eval: Test more error cases. 2020-04-13 16:29:01 +01:00
Valentin Hăloiu
4aeb7f83fa Check for existing runtime dirs first 2020-04-13 14:16:10 +01:00
Valentin Hăloiu
4b800a6246 Use XDG runtime dir on Unix when present 2020-04-13 14:16:10 +01:00
Qi Xiao
a36a372624 pkg: Fix small issues found by staticcheck. 2020-04-13 13:56:10 +01:00
Qi Xiao
64e282c828 pkg/eval: Replace ValuesUnwrapper with simple functions.
Also add structured BadValue error type to pkg/eval/errs.
2020-04-13 13:27:55 +01:00