Skip to content

Commit a43392a

Browse files
committed
Adjust vroom tests to work with --message-strictness=STRICT
Fix some subtle issues that were being ignored by the default message strictness GUESS-ERRORS and explicitly capture some echo messages into vroom tests so they can pass even in STRICT mode.
1 parent 0ab5420 commit a43392a

File tree

7 files changed

+22
-11
lines changed

7 files changed

+22
-11
lines changed

Diff for: vroom/autocmd.vroom

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ same formatter.
6060
You can disable it for the current buffer with :NoAutoFormatBuffer. After that,
6161
the buffer will go back to doing nothing special when you save.
6262

63-
:%delete
63+
@clear
6464
:NoAutoFormatBuffer
6565
% void f() {int i; SomeFunction(parameter,// comment<CR>
6666
|i);}

Diff for: vroom/buildifier.vroom

+7-4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Errors are reported using the quickfix list.
6767
! buildifier .*2> (.*)
6868
$ echo 'stdin:2:15: syntax error near ]' >\1 (command)
6969
$ 1 (status)
70+
~ (1 of 1): syntax error near ]
7071
#
7172
java_package(])
7273
@end
@@ -84,11 +85,12 @@ slightly different format, prefixed with the filename we passed.
8485
:set filetype=bzl
8586
% load()
8687

87-
> go
88+
:call cursor(1, 1)
8889
:FormatCode
8990
! buildifier .*2> (.*)
9091
$ echo '/foo/bar/BUILD:1:7: syntax error near )' >\1 (command)
9192
$ 1 (status)
93+
~ (1 of 1): syntax error near )
9294
load()
9395
@end
9496

@@ -104,9 +106,11 @@ report one column past the actual error.)
104106
If there are no errors, then the quickfix list is (currently, see
105107
https://github.com/google/vim-codefmt/issues/58) left alone:
106108

107-
> godd
109+
@clear
110+
:silent file /foo/bar/BUILD
111+
:set filetype=bzl
108112
% load('@io_bazel_rules_go//proto:def.bzl','go_proto_library')
109-
> go
113+
:call cursor(1, 1)
110114

111115
:FormatCode
112116
! buildifier -path /foo/bar/BUILD .*
@@ -116,4 +120,3 @@ https://github.com/google/vim-codefmt/issues/58) left alone:
116120
~ 1,1
117121
:echomsg len(getqflist())
118122
~ 1
119-
:set filetype=

Diff for: vroom/fish_indent.vroom

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ Errors are reported.
7979
! fish_indent .*2> (.*)
8080
$ echo test error >\1 (command)
8181
$ 1 (status)
82-
~ test error
82+
~ Error formatting file:* (glob)
83+
~ *test error* (glob)
8384
function f;
8485
@end
8586

Diff for: vroom/main.vroom

+8-4
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ the same number of lines again.
9595

9696

9797

98-
Formatting doesn't move the cursor.
98+
Even when the text under the cursor moves, formatting preserves the literal
99+
cursor position (except in formatter implementations that can intelligently
100+
preserve logical position; see examples in vroom/clangformat-cursor.vroom).
99101

100102
% void f() {int i;<CR>
101103
|SomeFunction();<CR>
102104
|}
103105

104-
> 1G/Fun<CR>
105-
:echomsg line('.') . ',' . col('.')
106-
~ 2,5
106+
:call cursor(2, 5)
107107
:FormatCode clang-format
108108
! clang-format .*
109109
$ void f() {
@@ -115,6 +115,10 @@ Formatting doesn't move the cursor.
115115
SomeFunction();
116116
}
117117
@end
118+
119+
In this case the cursor is still at position (2, 5), which is no longer over the
120+
F in SomeFunction.
121+
118122
:echomsg line('.') . ',' . col('.')
119123
~ 2,5
120124

Diff for: vroom/rustfmt.vroom

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Errors are reported using the quickfix list.
6868
| | - ^\n
6969
| | |\n
7070
| | un-closed delimiter'
71+
~ (1 of 1): this file contains an un-closed delimiter
7172
fn main() {
7273
@end
7374
:echomsg line('.') . ',' . col('.')

Diff for: vroom/shfmt.vroom

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Errors are reported using the quickfix list.
5858
! shfmt .*2> (.*)
5959
$ echo '<standard input>:1:7: reached EOF without matching { with }' >\1 (command)
6060
$ 1 (status)
61+
~ (1 of 1): reached EOF without matching { with }
6162
foo() {
6263
@end
6364
:echomsg line('.') . ',' . col('.')

Diff for: vroom/zprint.vroom

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ try to change directories:
9595
:set filetype=clojure
9696
:FormatCode
9797
! zprint .*
98+
$ no-op
9899
:set filetype&
99-
:0file
100+
:silent 0file
100101

101102
The default setting of zprint_options propagates Vim's textwidth setting to
102103
zprint's command-line.

0 commit comments

Comments
 (0)