Commit graph

17 commits

Author SHA1 Message Date
Martin von Zweigbergk
486f49435b cli: if $JJ_CONFIG points to a directory, read all files in it
It's annoying especially for tests to not be able to append to a
config file without knowing the contents (as you have to do with
TOML). Let's read all files in a directory if `$JJ_CONFIG` points to a
directory. Mercurial does that for its `$HGRCPATH` variable.
2022-04-10 09:13:51 -07:00
Martin von Zweigbergk
bc3c2db828 cli: print errors to stderr 2022-04-09 16:13:01 -07:00
Martin von Zweigbergk
28916ceb19 cli: in help output, list global options under separate heading
I've found it hard to read the `jj help` output because command
options are mixed with global options. This patch fixes that by
putting global options under a separate heading.
2022-04-02 14:57:48 -07:00
Martin von Zweigbergk
9b44822dc1 tests: add helper for failing tests as well 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
6344faa3fe tests: allow setting env var for all commands in TestEnvironment
Sometimes it's useful to have an environment variable set for all
commands in a test. This patch lets you do that by adding environment
variables to the `TestEnvironment` itself. These will then be set on
all subsequent commands.
2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
257b85a1b5 test: add helper for writing config file to TestEnvironment 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
710d51c45b tests: move testutils from src/ to tests/ 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
2ac62203d5 tests: add test for invalid config (#55) 2022-03-27 21:11:55 -07:00
Martin von Zweigbergk
23c7581ce1 tests: add a convenience function for running jj successfully
We very often expect success, and we sometimes want to get the stdout,
too. Let's add a convenience function for that. It saves a lot of
lines of code.
2022-03-26 21:11:42 -07:00
Martin von Zweigbergk
2f59e8b68a cli: respect $NO_COLOR environment variable 2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
7ba1c6bdb6 config: add support for a $JJ_CONFIG environment variable
It's useful for tests, scripts, and debugging to be able to use
specific config instead of the user's config. That's especially true
for our automated tests because they didn't have a place to read
config from on Windows before this patch (they read their config from
`{FOLDERID_RoamingAppData}`, which I don't think we can override in
tests).
2022-03-23 09:57:42 -07:00
Martin von Zweigbergk
a9eebe779e tests: set user and email in e2e tests
We don't display the user and email yet, so the only visible effect
this has on the tests is that some hashes change.
2022-03-10 12:38:07 -08:00
Martin von Zweigbergk
3a306e6a23 cleanup: fix formatting (missed in 5721436558) 2022-03-07 22:16:57 -08:00
Martin von Zweigbergk
5721436558 tests: use insta crate where appropriate
Thanks to @arxanas for the suggestion.
2022-03-07 20:23:55 -08:00
Martin von Zweigbergk
0c6d89581e tests: pass timestamps via env vars for reproducible hashes
This patch introduces a `JJ_TIMESTAMP` environment variable that lets
us specify the timestamp to use in tests. It also updates the tests to
use it, which means we get to simplify the tests a lot now that that
the hashes are predictable.
2022-03-05 08:48:42 -08:00
Martin von Zweigbergk
20ff88461b cli: error out if -R is not applicable
Closes #101.
2022-03-03 16:36:13 -08:00
Martin von Zweigbergk
6747a6c59c cli: add test of --no-commit-working-copy
I didn't add a test in #90 because the test cases needed to be cleaned
up first. They now look a bit better, so we can add test for the
flag.
2022-03-02 22:00:24 -08:00