1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Merge remote-tracking branch 'origin/master' into fix-1063

This commit is contained in:
Martin Nordholts
2020-12-28 21:57:38 +01:00
52 changed files with 422 additions and 710 deletions

View File

@@ -30,13 +30,11 @@ fn all_themes_are_present() {
"Solarized (light)",
"Sublime Snazzy",
"TwoDark",
"ansi-dark",
"ansi-light",
"ansi",
"base16",
"base16-256",
"gruvbox",
"gruvbox-dark",
"gruvbox-light",
"gruvbox-white",
"zenburn"
]
);

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
if ! which hyperfine > /dev/null 2>&1; then
if ! command -v hyperfine > /dev/null 2>&1; then
echo "'hyperfine' does not seem to be installed."
echo "You can get it here: https://github.com/sharkdp/hyperfine"
exit 1

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
if ! which hyperfine > /dev/null 2>&1; then
if ! command -v hyperfine > /dev/null 2>&1; then
echo "'hyperfine' does not seem to be installed."
echo "You can get it here: https://github.com/sharkdp/hyperfine"
exit 1

View File

@@ -837,3 +837,41 @@ fn show_all_mode() {
.stdout("hello·world␊\n├──┤␍␀␇␈␛")
.stderr("");
}
#[test]
fn plain_mode_does_not_add_nonexisting_newline() {
bat()
.arg("--paging=never")
.arg("--color=never")
.arg("--decorations=always")
.arg("--style=plain")
.arg("single-line.txt")
.assert()
.success()
.stdout("Single Line");
}
// Regression test for https://github.com/sharkdp/bat/issues/299
#[test]
fn grid_for_file_without_newline() {
bat()
.arg("--paging=never")
.arg("--color=never")
.arg("--terminal-width=80")
.arg("--wrap=never")
.arg("--decorations=always")
.arg("--style=full")
.arg("single-line.txt")
.assert()
.success()
.stdout(
"\
───────┬────────────────────────────────────────────────────────────────────────
│ File: single-line.txt
───────┼────────────────────────────────────────────────────────────────────────
1 │ Single Line
───────┴────────────────────────────────────────────────────────────────────────
",
)
.stderr("");
}

View File

@@ -175,4 +175,4 @@
\u{ad}␊
\u{ae}␊
␊
Here's·a·line·with·multiple·characters.
Here's·a·line·with·multiple·characters.␊

View File

@@ -0,0 +1,92 @@
if &compatible
 set nocompatible
endif
if has('win32') || has ('win64')
 let $VIMHOME = $HOME . "/vimfiles"
elseif v:false && v:true
 echo "Can't get here"
else
 let $VIMHOME = $HOME . "/.vim"
endif
" show existing tab with 2 spaces width
set tabstop=2
" when indenting with '>', use 2 spaces width
set shiftwidth=2
" always set autoindenting on
set autoindent
autocmd VimEnter * echo "Hello Vim"
" Allow :W and :Wq to save too
command! Wq :wq
command! W :w
augroup vimrc
 autocmd!
 autocmd FileType * echo "New filetype"
augroup END
function! s:echo(what)
 return a:what
endfunction
function! HelloWorld(name)
 let l:function_local = "function_local_var"
 let l:parts = split(l:function_local, "_")
 let l:greeting = "Hello " . a:name
 return s:echo(l:greeting)
endfunction
function! source#Hello()
 return "Hello from namespace"
endfunction
function! EchoFunc(...)
 for s in a:000
 echon ' ' . s
 endfor
endfunction
imap <C-h> <C-r>=HelloWorld("World")<CR>
command! -nargs=? Echo :call EchoFunc(<args>)
" TODO test stuff
let g:global = "global var"
let s:script_var = "script var"
let w:window_var = "window war"
let b:buffer_var = "buffer war"
let t:tab_var = "tab war"
echo v:false
3 + 5
echo "Hello" ==# "Hello2"
echo "Hello" ==? "Hello2"
echo "Hello" == "Hello2"
echo "Hello" is "Hello2"
echo "Hello" isnot "Hello2"
echo "Hello" =~ 'xx*'
echo "Hello" !~ "Hello2"
echo "Hello" !~ "Hello2"
echo "/This/should/not/be/a/regex"
" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)
set runtimepath=~/foo/bar
silent g/Aap/p
let g:dict = {}
let g:dict.item = ['l1', 'l2']
let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
silent g/regex/
silent v/regex/
silent %s/regex/not_regex/
filetype plugin indent on
syntax enable

View File

@@ -4,7 +4,7 @@ set -eou pipefail
script_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
output_directory=$(mktemp -d --suffix=.bat-syntax-regression-test)
output_directory=$(mktemp -d)
"$script_directory"/create_highlighted_versions.py --output="$output_directory"

View File

@@ -72,4 +72,4 @@ package TestSyntax {
var sndChannel:SoundChannel = mySound.play();
}
}
}
}

View File

@@ -56,4 +56,4 @@ set LDLIBS= ^
@set "LINK_FILES=%LINK_FILES% %%~f"
)
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%

View File

@@ -55,4 +55,4 @@
(println (factorial 5))
(log)
(log "Message"))

View File

@@ -16,4 +16,4 @@ EXPOSE 80/tcp
VOLUME [/var/lib/mysql/data]
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/entrypoint.sh"]

View File

@@ -13,4 +13,4 @@
*.patch -text
.gitattributes linguist-language=gitattributes
.gitkeep export-ignore
.gitkeep export-ignore

View File

@@ -104,4 +104,4 @@
[user]
email = f.nord@example.com
name = Frank Nord
signingkey = AAAAAAAAAAAAAAAA
signingkey = AAAAAAAAAAAAAAAA

View File

@@ -5,4 +5,4 @@
192.160.0.200 try.sample.test try #another comment
216.58.223.238 google.com
::1 localhost.try ip6-localhost
::1 localhost.try ip6-localhost

View File

@@ -382,4 +382,4 @@ install: all
@ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME)
uninstall:
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}

View File

@@ -108,4 +108,4 @@ $doe->setName('John Doe');
$ending = 2 > 3 ? "yep" : "nah";
?>
?>

View File

@@ -5,4 +5,4 @@ pywheels>=12.4 #a whitespace followed by comments
Nuitka<0.6.8.4
wxPython>=1.0, <=2.1
#this is another comment
#this is another comment

View File

@@ -0,0 +1,92 @@
if &compatible
set nocompatible
endif
if has('win32') || has ('win64')
let $VIMHOME = $HOME . "/vimfiles"
elseif v:false && v:true
echo "Can't get here"
else
let $VIMHOME = $HOME . "/.vim"
endif
" show existing tab with 2 spaces width
set tabstop=2
" when indenting with '>', use 2 spaces width
set shiftwidth=2
" always set autoindenting on
set autoindent
autocmd VimEnter * echo "Hello Vim"
" Allow :W and :Wq to save too
command! Wq :wq
command! W :w
augroup vimrc
autocmd!
autocmd FileType * echo "New filetype"
augroup END
function! s:echo(what)
return a:what
endfunction
function! HelloWorld(name)
let l:function_local = "function_local_var"
let l:parts = split(l:function_local, "_")
let l:greeting = "Hello " . a:name
return s:echo(l:greeting)
endfunction
function! source#Hello()
return "Hello from namespace"
endfunction
function! EchoFunc(...)
for s in a:000
echon ' ' . s
endfor
endfunction
imap <C-h> <C-r>=HelloWorld("World")<CR>
command! -nargs=? Echo :call EchoFunc(<args>)
" TODO test stuff
let g:global = "global var"
let s:script_var = "script var"
let w:window_var = "window war"
let b:buffer_var = "buffer war"
let t:tab_var = "tab war"
echo v:false
3 + 5
echo "Hello" ==# "Hello2"
echo "Hello" ==? "Hello2"
echo "Hello" == "Hello2"
echo "Hello" is "Hello2"
echo "Hello" isnot "Hello2"
echo "Hello" =~ 'xx*'
echo "Hello" !~ "Hello2"
echo "Hello" !~ "Hello2"
echo "/This/should/not/be/a/regex"
" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)
set runtimepath=~/foo/bar
silent g/Aap/p
let g:dict = {}
let g:dict.item = ['l1', 'l2']
let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
silent g/regex/
silent v/regex/
silent %s/regex/not_regex/
filetype plugin indent on
syntax enable

View File

@@ -31,4 +31,4 @@ emails:
- bob@example.com
- bill@example.com
supervisors:
- george@example.com
- george@example.com

View File

@@ -317,4 +317,4 @@ blank lines before and after.)
..
So this block is not "lost",
despite its indentation.
despite its indentation.

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
python="python3"
if ! command -v python3 &>/dev/null; then python="python"; fi