Commit Graph

89 Commits

Author SHA1 Message Date
9ed9a6fc3d Simplify HighlightingAssets::get_syntax() first_line logic (#1852)
And make self.get_first_line_syntax() be called lazily.
2021-09-16 17:01:12 +02:00
27f046ec03 Consolidate environment variable lists
We want to make sure that all of our test environments are clean from
possible outside modification. This consolidates the list of used
environment variables in Rust-based and Python-based integration tests.

Note that there is also a similar list in `src/bin/bat/main.rs` which
is even more exhaustive (for bug report collection). However, some
of these variables can not possibly have an effect on test environments.
2021-09-07 20:17:16 +02:00
f5c1cb2dff Run 'cargo fmt' 2021-08-19 07:18:05 +02:00
6c62ed5608 revamped integration test, made CHANGELOG changes 2021-08-14 22:02:58 +02:00
bf78288e9e feat(config): added recognition of $BAT_CONFIG_DIR 2021-08-14 22:02:58 +02:00
89217e0d58 Make --no-paging and --no-pager work again 2021-08-09 13:37:56 +02:00
bd797c75a4 integration_tests: Add diagnostic_sanity_check() 2021-08-07 20:07:46 +02:00
b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 2021-07-29 08:27:02 +02:00
b8a18d3ebb Use tempfiles for clircle tests 2021-02-28 23:04:49 +01:00
3af3549232 integration_tests: Use tempdir() in config_location_when_generating
For cleaner code.

Use the tempdir() function since that is recommended by the crate docs:
https://docs.rs/tempfile/3.2.0/tempfile/index.html
2021-02-28 18:09:44 +01:00
643f0bcbe3 integration_tests.rs: Add test config_location_when_generating
As a complement to #1556 to prevent #1550 from coming back.

The test purposefully fails if ca60937c2e is reverted.
2021-02-28 18:09:44 +01:00
ca60937c2e Do not ignore non-existent BAT_CONFIG_PATH
Do not ignore `BAT_CONFIG_PATH` if it doesn't exist. Both when
generating a new config file with `--generate-config-file` and
when attempting to read the config.

Also, provide a better error message in case the file can not
be created.

closes #1550
2021-02-28 10:08:24 +01:00
573f34d757 Update dependencies; replace unmaintained (#1522)
* Update dependencies; replace unmaintained

* Fix errors

* Revert dependency changes

* Revert git2 to 0.13.15

Co-authored-by: David Peter <mail@david-peter.de>
2021-02-16 08:50:41 +01:00
dd0d44bbb3 Fix #1413 Can't use bat at all! (Error: Use of bat as a pager is disallowed...)
Fixed by implementing the proposal by sharkdp:

* Allow PAGER=bat, but ignore the setting in bat and simply default to
  less. Unless of course, BAT_PAGER or --pager is used to overwrite the
  value of PAGER.

* Disallow the usage of bat within BAT_PAGER and --pager.
2021-01-11 21:56:10 +01:00
eda72c31b2 tests: Move 'mocked pagers' utils to separate file 2021-01-10 14:05:39 +01:00
c2c2b0211a fn mocked_pager: Simplify with format! 2021-01-10 13:26:40 +01:00
dd6f57e107 pager.rs: Some comment fixups 2021-01-10 13:25:18 +01:00
da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-07 12:58:26 +01:00
35e3c51b75 Fix unused import warning 2021-01-06 22:09:22 +01:00
59c9105c25 Fix clippy warnings in tests on Windows 2021-01-06 22:08:14 +01:00
46487b201f Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-06 14:30:55 +01:00
9ccb667653 Add integration test for unparsable pager
Right now all tests pass even if we e.g. return

    Ok(OutputType::stdout())

instead of doing

    .chain_err(|| "Could not parse pager command.")?

so add a test to make sure this functionality don't break.
2021-01-06 11:58:08 +01:00
b600f62ab6 Add unix specific integration test about running bat without any arguments 2021-01-05 18:21:16 +01:00
ace655e164 Add integration tests for clircle cycle detection 2021-01-05 18:21:16 +01:00
e87c554ccd tests: Make mocked pagers work on Windows 2021-01-04 20:22:04 +01:00
df33ed05dd Run PATH-dependent tests serially
Since PATH is a shared resource.
2021-01-04 15:45:57 +01:00
c9efdd68ed Add integration tests for 'more' and 'most' used as pagers 2021-01-04 10:30:55 +01:00
22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 2020-12-30 08:25:39 +01:00
dcfe883f4b Simplify and polish pager.rs and related code 2020-12-28 22:39:34 +01:00
cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 21:57:38 +01:00
a63bb08eda Add test 'grid_for_file_without_newline' (for issue #299 fix)
This is a regression test for the fix for issue #299. If that fix is
reverted, currently only one test ('header_padding') fails. But that
test is for a different use case, so add a dedicated regression test for
the particular use case issue #299 is about.
2020-12-21 21:45:34 +01:00
3e9afe2974 Add integration test for nonexisting newline 2020-12-21 08:34:22 +01:00
986d0e9777 Ignore PAGER=most by default with a warning to stderr
closes #1063
2020-11-27 06:47:46 +01:00
bd2e9917da Revert "Add cycle detection integration tests"
This reverts commit ec60d84265.
2020-11-24 21:40:11 +01:00
4f0116bee7 Add cycle detection integration tests 2020-11-23 14:06:54 +01:00
61f947a580 Merge pull request #1276 from tommilligan/style-rule
style: add component 'rule' for horizontal file delimiter
2020-10-31 23:14:00 -07:00
9837948c3a Throws an error when bat is being user as pager.
As mentioned on #1334 `bat` should not be used as a value for `pager`,
this change checks both the balue of `bat` provided as a parameter or
as an environment variable.
2020-10-29 19:33:58 +01:00
1614f80366 add integration test for grid overriding rule 2020-10-12 09:04:57 +01:00
c1af6ff2e6 Add integration test for style rule 2020-10-12 09:04:27 +01:00
aa4000cb0d style: add component 'rule' for horizontal file delimiter 2020-10-12 09:04:27 +01:00
71b2089384 Code formatting 2020-09-20 20:47:21 +02:00
6faf61552e Fix integration test 2020-07-09 08:15:04 +02:00
f53ea60ed4 Merge remote-tracking branch 'sharkdp/master' 2020-07-02 00:04:55 -07:00
3c5ce9f86c Enable non-printable chars for redirected output (#1061) 2020-07-02 09:36:58 +04:00
bfac6fd85c Add integration tests 2020-06-30 12:41:50 -07:00
92e93682c6 Revert f8ed8aa7 (add test instrumentation to help understand failing tests) per PR feedback/owner request
- reverts commit f8ed8aa74b
2020-06-03 09:13:47 +02:00
4840c7cd78 Tests ~ add predicate normalization for tests using echo 2020-06-03 09:13:47 +02:00
71ab4a2058 Tests ~ revert to echo (after fixed 'windows' pager process execution) 2020-06-03 09:13:47 +02:00
01af28b781 Tests ~ add instrumentation to visualize text differences in failing tests 2020-06-03 09:13:47 +02:00
3a7743ffc5 Tests ~ echo has portability issues; for CI, replace with printf
- using `echo` on 'windows' platforms requires process execution indirectly via the shell
- `printf` is available on all GHA CI platforms
  - `printf` is *not* available on usual 'windows' platforms; so this is just temporizing, awaiting a true fix
2020-06-03 09:13:47 +02:00