Commit Graph

6457 Commits

Author SHA1 Message Date
Qi Xiao
e4d13cf231 CI configs: Use curl -f to suppress 404 content. 2024-02-10 17:47:40 +00:00
Qi Xiao
1eb82fbc41 Require Go 1.21. 2024-02-10 17:44:46 +00:00
Qi Xiao
ea88e07e31 Various CI config updates.
GitHub Actions:

- Fix skipping of test coverage on old Go; GitHub Actions doesn't have true
  booleans (https://github.com/actions/runner/issues/1483)

- Update workflow versions.

Cirrus:

- Download Go toolchain from go.dev on all BSD platforms.

Both:

- Bump Go to 1.22 (with one GitHub Actions job still running Go 1.21).
2024-02-10 17:34:27 +00:00
Qi Xiao
a7365ec41e .github: Invert the "old-go" matrix parameter, and omit it from job name. 2024-02-10 16:19:20 +00:00
Qi Xiao
71a682629d Remove support for ~/.elvish. 2024-02-10 16:07:04 +00:00
Qi Xiao
2375f94d23 .cirrus.yml: Install coreutils in the build binaries workflow. 2024-02-06 15:34:41 +01:00
Qi Xiao
33190711eb tools/buildall.sh: Make zip file reproducible by fixing the mtime.
This fixes #1722.
2024-02-06 15:01:11 +01:00
Qi Xiao
56469f853b pkg/buildinfo: Bump VersionBase as v0.20.x has been branched.
Commits from this point now target v0.21.0.
2024-02-06 14:31:22 +01:00
Qi Xiao
a6a33daedf 0.20.0-release-notes.md: Fix typo. 2024-02-06 14:24:37 +01:00
Qi Xiao
6029a739ee pkg/buildinfo: Slightly simplify instruction for releasing. 2024-02-06 14:22:09 +01:00
Qi Xiao
c9e26cc20f pkg/prog: Bump deprecation level to 20.
Also add support for setting deprecation level in transcript tests.
2024-02-06 14:16:10 +01:00
Qi Xiao
7e0b6ee8e6 tools/pre-push: Include cross-compilation check for tests too. 2024-02-01 15:02:39 +00:00
Qi Xiao
aea0e08202 pkg/mods/unix: Fix test on Windows. 2024-02-01 14:51:55 +00:00
Qi Xiao
cd621b10da CONTRIBUTING.md: Document how to mock dependencies. 2024-02-01 14:46:37 +00:00
Qi Xiao
d7fe04414b pkg/eval/evaltest: Import all builtin modules.
This removes the need for various "use-foo" setups for the standard library
modules - test code can just call "use foo" like normal Elvish code.
2024-02-01 14:46:37 +00:00
Qi Xiao
0afb509d29 Make all evaltest callsites external tests. 2024-02-01 14:02:05 +00:00
Qi Xiao
4bc73cb1f6 pkg/mods/unix: Fix test for FreeBSD.
This fixes #1763.
2024-02-01 11:21:33 +00:00
Qi Xiao
16ac1cce55 .cirrus.yml: Disable ASLR on FreeBSD so that the tests actually run.
go test -race is not compatible with ASLR, but a current Go bug causes the test
to still appear as successful: https://github.com/golang/go/issues/65425.

This commit should result in a test failure on Cirrus CI's FreeBSD runner,
because there's currently a FreeBSD-specific bug in a test case (#1763).
2024-02-01 11:14:00 +00:00
Qi Xiao
2ee156b6d2 pkg/mods/os: Set umask to 0 in mkdir &perm tests.
This fixes #1762.
2024-01-31 23:18:57 +00:00
Qi Xiao
b1815833a9 vscode: Simplify .gitignore. 2024-01-31 09:48:56 +00:00
Qi Xiao
d4f11db983 pkg/eval/evaltest: Remove the old testing framework. 2024-01-30 20:53:56 +00:00
Qi Xiao
27495be1b9 Fixup for #1760.
- Use standard error types.

- Support float64 that stores an integer.

- Don't incur unnecessary overhead for int arguments.
2024-01-30 20:28:01 +00:00
Qi Xiao
183927cffc Convert tests to transcript tests. 2024-01-30 20:21:39 +00:00
Qi Xiao
747a34aef1 pkg/eval/evaltest: Generate .elvts files from non-transcript tests.
This is done implicitly in evaltest.Run. This commit will be reverted after the
.elvts files are generated and cleaned up.
2024-01-30 20:15:58 +00:00
Qi Xiao
0e2999dee8 Support using Elvish transcripts as tests.
- evaltest.TestTranscriptsInFS runs transcripts in .elv and .elvts files as
  tests.

- Extend the syntax of Elvish transcripts with headings and comments; the former
  is used to split a single .elvts file into multiple sessions.
2024-01-30 20:15:58 +00:00
Qi Xiao
d71afb4443 pkg/fsutil: Handle / as path separator on Windows.
Both / and \ are valid path separators on Windows; handle both of them.
2024-01-30 20:15:58 +00:00
Qi Xiao
b91c655085 pkg/edit: Fix unnecessary creation of variable in add-var implementation. 2024-01-30 20:15:58 +00:00
Qi Xiao
f1a4fd869b pkg/tt: Report the filename and line of failed test case. 2024-01-30 20:15:58 +00:00
Qi Xiao
f282768e3c pkg/testutil: Let Dir implement fs.FS. 2024-01-30 20:15:58 +00:00
Qi Xiao
27c3a40236 pkg/diff: Take string inputs, and add DiffNoHeader. 2024-01-30 20:15:58 +00:00
Tw
e6380c1e0d support big num for base cmd
Signed-off-by: Tw <tw19881113@gmail.com>
2024-01-30 19:55:24 +00:00
Kurtis Rader
3c666ef9cd Fix broken readline binding link
The primary purpose of this change is to fix a broken link to the
readline binding source. A secondary purpose is a baby step to
addressing issue #1719.

Related #1719
2024-01-23 09:56:26 +00:00
Qi Xiao
82d7730e59 pkg/mods/flag: Don't put addFlag in the init clause of if statement.
The pattern "if err := ...; err != nil" is popular in certain Go projects as it
saves one line of code, but Elvish's codebase only uses the init clause in an if
statement when the init clause is used to calculate something that's only used
in the condition or the if body. In this case addFlag has side effects that's
relevant outside the if block, so shouldn't be put in the init clause.
2024-01-23 09:53:05 +00:00
Kurtis Rader
38ced1a7a5 Detect invalid default flag value in flag:call
Fixes #1755
2024-01-23 09:52:23 +00:00
Qi Xiao
464cfb64c6 pkg/mods/os: Don't guard the mkdir workaround with GOOS check.
This behavior of mkdir is shared by all BSDs and macOS. Also expand the comment
a bit so that the reader don't have to read the Go issue.
2024-01-23 09:46:26 +00:00
Kurtis Rader
c6d78a528a Replace epm dependency on rm with os:remove-all
Remove the `epm` dependency on `rm` with `os:remove-all` so it is slightly
easier to use the `epm` command on Windows.

There aren't any unit tests for this but I verified it worked by running
the following statements on my macOS and Windows systems:

    epm:install github.com/doubleagent/rivendell
    epm:uninstall github.com/doubleagent/rivendell

Related #1661
2024-01-22 22:04:59 +00:00
Qi Xiao
b1815eb33d pkg/mods/os: Work around a quirk of FreeBSD's mkdir in the test.
This fixes #1748.
2024-01-22 21:56:01 +00:00
Qi Xiao
8003693f47 website/tools: Fix the recording of "has_broken" in check-rellinks.py.
The bug led to the script not exiting with 1 when there were errors. Fix the
error too.
2024-01-22 17:24:27 +00:00
Qi Xiao
bf40c51b6e website/tools: Generalize the check for slashes in check-rellinks.py.
Also:

- Clean up the script a bit, adding more comments.

- Report line and column number of offending links.

- Fix the (more minor) issues found by the new checks.
2024-01-22 17:20:02 +00:00
Qi Xiao
c1b403e46a website: Remove the dependency on SQLite3 CLI for generating docset.
Python bundles SQLite3, so just use that.
2024-01-22 16:16:56 +00:00
Kurtis Rader
3f4fbff260 Provide more info for an invalid doc link
Make it more obvious why a documentation reference link is invalid when
the URL path incorrectly includes a trailing slash. This would have
saved me an hour of debugging when I was working on a change that
included a reference like this one:

    [`edit:histlist:start`](../ref/edit.html/#edit:histlist:start)

Fixes #1749
2024-01-22 15:20:50 +00:00
Qi Xiao
fef5049716 pkg/eval: Simplify how exception tracebacks are written.
*Exception.Show used to work differently when the traceback contains one frame
vs more frames. Harmonize how they work, and consistent with how parse errors
and compilation errors are shown.
2024-01-16 12:50:59 +00:00
Qi Xiao
cfe4c0051d pkg/diag: Remove Complain and Complainf
The former is unused, and the latter is only used from pkg/edit/config_api.go.
Subsume the logic into ShowError, and use that from pkg/edit/config_api.go.
2024-01-16 11:09:57 +00:00
Qi Xiao
5775c8b3ed pkg/diag: Rework API and presentation of Context and Error.
- Change Context to export all its fields.

- Include end position in Context, and include it in Show.

- Remove the Type field from Error, and express it using an ErrorTag type
  parameter instead.

- Make {Pack Unpack}CognateErrors type-safe with the new ErrorTag mechanism, and
  rename them to just {Pack Unpack}Errors.
2024-01-16 11:04:52 +00:00
Qi Xiao
76e2d3cb61 Fix test on Windows.
A Windows test case was missed when changing the pkg/tt API.
2024-01-11 16:36:52 +00:00
Qi Xiao
6dfa4f623b .github/workflows: Fix step condition.
Expressions that start with ! must use ${{ }} explicitly:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif
2024-01-11 16:31:41 +00:00
Qi Xiao
36e1272fd7 .github/workflows: Clean up workflow definitions.
- Fix the cache key used in check_website.yml. It was blindly copied from ci.yml
  and contained matrix parameters that are not present in this workflow.

- Simplify the derivation of OS_TYPE used for tagging coverages to use a ternary
  expression.

- Simplify the condition for uploading coverages by introducing a new "old-go"
  matrix parameter.
2024-01-11 15:44:50 +00:00
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
82b32d4ace website/tools/mkdsidx.py: Fix use of quotes in generated SQL.
The script used to emit double-quoted strings, which is not standard SQL
syntax and support for it in SQLite been disabled by default since 3.41.0
(https://www.sqlite.org/changes.html).
2024-01-11 00:03:32 +00:00
Qi Xiao
6a4204dec5 Bump Go version in CI tasks for checking binaries. 2024-01-10 23:41:51 +00:00