Commit Graph

497 Commits

Author SHA1 Message Date
David Peter
ea2faf45e4 Simplify cargo-target-dir extraction 2021-11-23 08:14:49 +01:00
David Peter
1822c981da Move comparison.sh benchmark script to documentation 2021-11-23 08:14:49 +01:00
Shun Sakai
619cf6e6d6 Add MediaWiki syntax 2021-11-22 19:46:29 +01:00
Bojan Đurđević
d6ed5e6746
Support for ignored-suffix CLI arguments (#1892) 2021-11-19 17:05:23 +01:00
David Peter
0b63ad5e8b create_highlighted_versions: fix misleading/wrong error message 2021-10-24 12:24:46 +02:00
Martin Nordholts
dde770aa21 Add bat panic regression test for Svelte files with embedded LiveScript
Without a LiveScript syntax present, the Svelte test will now fail with a panic.
2021-10-23 13:35:32 +02:00
Martin Nordholts
6eb2cc9cac Add LiveScript syntax
The file `LiveScript.sublime-syntax` is a pure export from a licenced version
of Sublime Text, Version 3.1.1, Build 3176 with
assets/syntaxes/02_Extra/LiveScript/Syntaxes/LiveScript.tmLanguage as the source
file.
2021-10-23 13:35:32 +02:00
Diva M
2339d78bf4 update snapshot tests 2021-10-17 21:21:23 +02:00
Martin Nordholts
994c21a5e1
syntax-tests: Make CpuInfo test actually work (#1887)
* syntax-tests: Make CpuInfo test actually work

File extension matching is case-sensitive, so extension needs to be .cpuinfo for
the syntax to actually be used.

* Also fix MemInfo
2021-10-06 06:50:11 +02:00
Georgy Komarov
d04a83de7b Add Racket syntax 2021-10-03 19:17:26 +02:00
David Peter
44a332c1c4 Parallelize syntax regression tests
The syntax highlighting regression tests can be trivially parallelized.
On my notebook (8 core), this results in a 3.9x speedup.
2021-09-22 22:18:01 +02:00
Martin Nordholts
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
David Peter
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
Martin Nordholts
d935ea1cda
Add regression testing for the custom assets functionality (#1829)
The test is following the same steps regular users are instructed to follow:
https://github.com/sharkdp/bat/blob/master/README.md#adding-new-syntaxes--language-definitions
2021-09-07 17:01:15 +02:00
Ville Skyttä
7c41bd72da assets: add Debian ucf backups to ignored suffixes
Refs https://manpages.debian.org/bullseye/ucf/ucf.1.en.html
2021-08-29 19:55:00 +02:00
a1346054
51edacb5eb style: trim excess whitespace 2021-08-21 23:07:37 +02:00
a1346054
5197ef9048 fix: spelling 2021-08-21 23:07:37 +02:00
a1346054
19678527e5 chore(find-slow-to-highlight-files.py): be explicit about using python3
In many distros, `python` no longer leads to anything, and instead
`python2` or `python3` need to be explicitly run.
2021-08-21 23:07:37 +02:00
Martin Nordholts
f5c1cb2dff Run 'cargo fmt' 2021-08-19 07:18:05 +02:00
Keith Hall
133b06e945 Fix syslog syntax highlighting when no colon after "process" 2021-08-16 22:15:39 +03:00
Mario Finelli
699f1e65cc Add slim syntax test 2021-08-16 06:16:53 +02:00
Bill Risher
6c62ed5608 revamped integration test, made CHANGELOG changes 2021-08-14 22:02:58 +02:00
Bill Risher
bf78288e9e feat(config): added recognition of $BAT_CONFIG_DIR 2021-08-14 22:02:58 +02:00
Ville Skyttä
2d92a4dbb3 Allow colon in syslog loghost
Makes it work with IPv6 addresses.
2021-08-11 21:36:43 +03:00
Ville Skyttä
f508ddf66d Allow period in syslog loghost
Makes it work with FQDN's and IPv4 addresses.
2021-08-11 16:43:04 +03:00
Ville Skyttä
02218c916c Allow period in syslog process name 2021-08-11 16:41:56 +03:00
Martin Nordholts
89217e0d58 Make --no-paging and --no-pager work again 2021-08-09 13:37:56 +02:00
Martin Nordholts
bd797c75a4 integration_tests: Add diagnostic_sanity_check() 2021-08-07 20:07:46 +02:00
Layle | Luca
51c7eb7ac1
Included LLVM syntax highlighting submodule and added regression tests 2021-08-05 20:20:33 +02:00
Keith Hall
6d5ff671e7 Add HTTP Request/Response syntax as a git submodule 2021-07-29 21:36:16 +02:00
Martin Nordholts
b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 2021-07-29 08:27:02 +02:00
Martin Nordholts
a81009607a HighlightingAssets: Make .syntaxes() and syntax_for_file_name() failable
Or rather, introduce new versions of these methods and deprecate the old ones.

This is preparation to enable robust and user-friendly support for lazy-loading.
With lazy-loading, we don't know if the SyntaxSet is valid until after we try to
use it, so wherever we try to use it, we need to return a Result. See discussion
about panics in #1747.
2021-07-29 08:26:18 +02:00
Sarvesh MD
f464b1ba39 Update battest.py
Add decorator test `@classmethod` and fixed spellings.
2021-07-26 08:44:05 +02:00
Ville Skyttä
7537e309d8 Add groff syntax
The syntax is named "Man Page" upstream, but our man page syntax is
different, it's for rendered man pages. Rename to Groff and remove
`.man` from extensions.
2021-07-25 13:27:30 +02:00
David Peter
64763eafbe Update Julia syntax test 2021-07-13 09:07:29 +02:00
Ville Skyttä
ddb39ef2f6 Add syntax tests for ignored filename suffixes 2021-07-09 06:34:11 +02:00
Mohamed Abdelnour
12ecb325c9 Modify Linguist overrides 2021-06-14 08:36:20 +02:00
Mohamed Abdelnour
c18afcb01a Add Verilog syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
63043d4a60 Add varlink syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
76034880ae Add TypeScriptReact syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
768189859a Add Stylus syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
6e5a2a5c51 Add Strace syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
9935c4984c Add Robot Framework syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
a0a5e30c39 Add Rego syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
4126bbeead Add Puppet syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
a5b79295d7 Add NAnt Build File syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
e917784932 Add Literate Haskell syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
f46b90d28d Add jsonnet syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
64cbfbed47 Add Java Server Page (JSP) syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
1ced35ec76 Add 'NOTICE' to list of file names to skip 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
16d346773b Add Fortran Namelist syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
b02120cf66 Add Fortran (Fixed Form) syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
702b5caf2d Add Fortran (Modern) syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
d395f64f58 Add F# syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
c9627040cc Add CoffeeScript syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
b1f69434f9 Add Cabal syntax test file 2021-06-01 22:36:56 +02:00
Mohamed Abdelnour
8435cad602 Merge master 2021-05-15 09:41:27 +02:00
Mohamed Abdelnour
8b6341458b Add XAML test file 2021-05-14 23:59:11 +02:00
Mohamed Abdelnour
8b787b4f70 Add dash test file 2021-05-14 23:02:23 +02:00
David Peter
bfa9c3bef6
Merge branch 'master' into feature/dark_plus_theme 2021-05-12 22:28:10 +02:00
David Peter
2904f24ea8
Merge pull request #1606 from sharkdp/syslog
Improve Syslog and general log file highlighting
2021-05-12 22:22:50 +02:00
Ersikan
e219c8fc03 Update SublimeEthereum version
A fix I submitted upstream was merged, and this commit bumps the submodule
to include it.
2021-05-12 11:42:17 +02:00
Ersikan
9eb26b702c Add syntax test for Vyper language 2021-05-12 11:42:17 +02:00
Ersikan
c933be926d Add syntax tests for Solidity language. 2021-05-12 11:42:17 +02:00
David Peter
5db3c93057
Merge branch 'master' into syslog 2021-05-12 11:34:35 +02:00
David Peter
aa442b5795
Merge branch 'master' into feature/dark_plus_theme 2021-05-12 11:30:49 +02:00
Keith Hall
848ceb6f10 Remove variable.other from CSV highlighting 2021-05-11 21:04:02 +02:00
Keith Hall
3559079de0 Improvements to CSV highlighting 2021-05-11 21:04:02 +02:00
Keith Hall
7c4edacb2b Add independent log syntax 2021-04-06 23:55:22 +03:00
Keith Hall
782ede5db5 improve syslog syntax 2021-04-05 22:24:04 +03:00
Keith Hall
1537733e6b replace Syslog dependency with a custom syntax 2021-04-04 22:47:01 +03:00
Keith Hall
ba0d43672b add example syslog file for highlighting tests 2021-04-04 22:41:48 +03:00
PatriotRossii
0cd52e5be1
Add "Visual Studio Dark+" theme to vec of themes 2021-03-24 18:39:06 +05:00
Sean McLoughlin
d89fa3ebc2 Add SystemVerilog support 2021-03-15 07:21:15 +01:00
Niklas Mohrin
b8a18d3ebb Use tempfiles for clircle tests 2021-02-28 23:04:49 +01:00
Martin Nordholts
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
Martin Nordholts
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
David Peter
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
Keith Hall
7768433d09 Improve Monokai Extended JSON key color with a patch 2021-02-28 09:55:24 +01:00
David Peter
94496df3b0 Fix broken resolv.conf highlighting
closes #1510

The change in `create_highlighted_versions.py` fixes a "unknown theme
"'1337'" warning. The single quotes were wrong. `bat` was always falling
back to the default theme, so let's use that for now.
2021-02-16 22:15:31 +01:00
Caden Haustein
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
Martin Nordholts
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
Martin Nordholts
eda72c31b2 tests: Move 'mocked pagers' utils to separate file 2021-01-10 14:05:39 +01:00
Martin Nordholts
c2c2b0211a fn mocked_pager: Simplify with format! 2021-01-10 13:26:40 +01:00
Martin Nordholts
dd6f57e107 pager.rs: Some comment fixups 2021-01-10 13:25:18 +01:00
Martin Nordholts
02e6ff4183 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-10 11:56:03 +01:00
sharkdp
4c523af1ab Add gnuplot syntax
closes #1431
2021-01-09 22:35:50 +01:00
sharkdp
6d27df3b77 Use unstable sort for theme test 2021-01-09 19:43:39 +01:00
sharkdp
73d14f4655 Use BatTester::default instead of BatTester::new 2021-01-09 19:43:39 +01:00
Martin Nordholts
da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-07 12:58:26 +01:00
sharkdp
35e3c51b75 Fix unused import warning 2021-01-06 22:09:22 +01:00
sharkdp
59c9105c25 Fix clippy warnings in tests on Windows 2021-01-06 22:08:14 +01:00
Martin Nordholts
46487b201f Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-06 14:30:55 +01:00
Martin Nordholts
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
Niklas Mohrin
b600f62ab6 Add unix specific integration test about running bat without any arguments 2021-01-05 18:21:16 +01:00
Niklas Mohrin
ace655e164 Add integration tests for clircle cycle detection 2021-01-05 18:21:16 +01:00
Martin Nordholts
478233f795 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-04 21:02:51 +01:00
Martin Nordholts
e87c554ccd tests: Make mocked pagers work on Windows 2021-01-04 20:22:04 +01:00
Martin Nordholts
df33ed05dd Run PATH-dependent tests serially
Since PATH is a shared resource.
2021-01-04 15:45:57 +01:00
Martin Nordholts
c9efdd68ed Add integration tests for 'more' and 'most' used as pagers 2021-01-04 10:30:55 +01:00
Ethan P
1b549ecc66
Merge branch 'master' into improved-benchmark 2021-01-02 21:35:58 -08:00
sharkdp
b5bdba8b16 Svelte syntax test: rename license file 2021-01-02 22:34:15 +01:00
sharkdp
522c97f5ad DotEnv syntax test: add missing newline 2021-01-02 22:34:15 +01:00
sharkdp
b3f34529b5 Update Zig syntax test output 2021-01-02 21:34:25 +01:00
Paul Smith
c76e27851c Add support for Zig
Adds syntax support for source code for the Zig programming
language. https://ziglang.org/
2021-01-02 21:34:25 +01:00
Julian Berman
af8a8035e8 Add a Lean highlighting test file. 2021-01-02 09:45:19 +01:00
Martin Nordholts
22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 2020-12-30 08:25:39 +01:00
Ethan P
3ed0081f1f
Improve benchmark script to support cargo/config target-dir 2020-12-29 15:07:22 -08:00
Martin Nordholts
dcfe883f4b Simplify and polish pager.rs and related code 2020-12-28 22:39:34 +01:00
Martin Nordholts
cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 21:57:38 +01:00
Ensar Sarajčić
29ea396c31 Improve VimL regex highlighting
**NOTES:**
- PR is not yet merged in upstream repository (https://github.com/SalGnt/Sublime-VimL/pull/12),
but sublime-syntax file is already updated with changes.
- Updated syntax test files are added as well

This fixes #1064
2020-12-28 09:33:32 +01:00
Ensar Sarajčić
171d215f91 Add case from #1604 to VimL syntax-test source 2020-12-28 09:33:32 +01:00
Ensar Sarajčić
cc6109a751 Add syntax highlighting tests for VimL
Adds a syntax highlighting test for VimL
with source file based on parts of my own configuration
changed to cover as much of syntax as possible.

**NOTES:**
Last line of source (`syntax enable`) does not get highlighted,
since `syntax` keyword is not part of highlighting rules.

Related to #1213
2020-12-28 09:33:32 +01:00
John Meow
3d07dec8fd Use Briles/gruvbox .tmTheme files instead of peaceant's port 2020-12-21 21:52:04 +01:00
Martin Nordholts
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
sharkdp
e0207f8167 Fix test 2020-12-21 17:05:10 +01:00
David Peter
cc7b89faf8
Merge pull request #1440 from Enselic/fix-1438-newline-can-be-added-even-if-style-plain
Don't add artificial newline to last line if --style=plain
2020-12-21 09:24:26 +01:00
VeryTastyTomato
973ea984c8 fix: warnings of ShellCheck
SC2155: Declare and assign separately to avoid masking return values.
SC2164: Use cd ... || exit in case cd fails.
SC2230: which is non-standard. Use builtin 'command -v' instead.
2020-12-21 09:08:54 +01:00
sharkdp
3e9afe2974 Add integration test for nonexisting newline 2020-12-21 08:34:22 +01:00
David Peter
73c16574e6
Merge branch 'master' into fix-1438-newline-can-be-added-even-if-style-plain 2020-12-21 08:22:01 +01:00
Martin Nordholts
60e00d49a9
Fix #1443 macOS: regression_test.sh: mktemp: illegal option (#1444)
The macOS version of mktemp does not recognize the --suffix option.
Using pure -d should work since, it seems [1], macOS 10.11 however.

So to make the script work on macOS, stop using the --suffix option.

The downside is of course that the temporary dir will have an anonymous
name, but I see no risk of confusion given how short-lived the usage of
the dir is, and given the context it is used.

[1] https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
2020-12-21 08:16:49 +01:00
Martin Nordholts
68d525cd8b Don't add artificial newline to last line if --style=plain
This fixes #1438.

Note however, that using a pager such as less will add a newline itself.
So to actually not print a newline for such files, you need to either
disable paging:

  bat --style=plain --paging=never no-newline-at-end-of-file.txt

or use a "pager" that does not add a newline:

  bat --style=plain --pager=cat no-newline-at-end-of-file.txt

Note that we also update syntax tests file since a bunch of them had
missing newlines on the last lines.
2020-12-19 10:32:50 +01:00
Martin Nordholts
986d0e9777 Ignore PAGER=most by default with a warning to stderr
closes #1063
2020-11-27 06:47:46 +01:00
sharkdp
bd2e9917da Revert "Add cycle detection integration tests"
This reverts commit ec60d84265.
2020-11-24 21:40:11 +01:00
henil
591eba66a3 add new syntax test files 2020-11-23 15:43:58 +01:00
Niklas Mohrin
4f0116bee7 Add cycle detection integration tests 2020-11-23 14:06:54 +01:00
Byron Alley
3dc5fc54df Import syntax regression test for Ruby Haml 2020-11-01 09:46:54 +01:00
Byron Alley
bac84b4c8b Add sshd_config syntax highlighting test 2020-11-01 09:38:03 +01:00
Ethan P
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
David Peter
3a612f063e
Merge branch 'master' into master 2020-10-30 19:36:27 +01:00
Ján Priner
9daea73bba Add Ninja highlight test 2020-10-30 19:14:51 +01:00
Adrian Rivera
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
Kyle Hubert
072fb380d8
Add Svelte as a syntax 2020-10-29 19:33:09 +01:00
Horki
cc6cf48256 1213: org mode highlight testing 2020-10-29 19:21:46 +01:00
Horki
e571cb553b 1213: nix; added trailing new line 2020-10-25 21:03:30 +01:00
Horki
bf9f6e872d 1312: nix; fixed src 2020-10-25 21:03:30 +01:00
Horki
8348c1b746 1213: nix; fix buildInputs arr 2020-10-25 21:03:30 +01:00
Horki
0a9744ac95 add nix highligh 2020-10-25 21:03:30 +01:00
sharkdp
9dd807344c Ignore 'all_themes_are_present' unit test by default 2020-10-25 08:18:55 +01:00
Armand Philippot
2ecebf8ff2 Add Coldark themes to unit test 2020-10-25 08:18:55 +01:00
Dobe Peter
ec8072d51f Add PowerShell syntax test
Part of the work for issue #1213.

A short PowerShell script and the corresponding syntax-highlighted output
has been added. The script exhibits many of the peculiarities of the
PowerShell syntax.
2020-10-25 08:04:27 +01:00
Stefano Probst
7a7bb80e23 Add Git Config syntax test file
cc sharkdp/bat#1213
2020-10-24 14:45:54 +02:00
Alan Berndt
99ac5c3045 Add fairly complex nginx config.
This is to contribute to issue #1213.  I took some of the more
complicated servers I am running as examples.  Everything looks to be
correctly highlighted compared to vim's syntax highlighting.
2020-10-24 14:10:51 +02:00
R1tschY
efab00a9de Add Git Attributes syntax test 2020-10-24 14:09:52 +02:00
Keith Hall
cfdb853ea6 End highlighting of C code in man pages when no longer relevant 2020-10-24 12:30:25 +02:00
Keith Hall
41e857ea16 Highlight C code in all man pages sections 2020-10-24 12:30:25 +02:00
Frank Schmitt
5b2da2b08d #1213 expanded D test file 2020-10-24 12:28:15 +02:00
Frank Schmitt
5e0a608ea6 #1213 added very basic test file for D 2020-10-24 12:28:15 +02:00
R1tschY
3729aefb6f Add QML syntax test 2020-10-24 12:27:16 +02:00
henil
8a2122b4a4 Add test file for /etc/group 2020-10-24 12:26:41 +02:00