Bug#954016: vim-runtime: tap.vim: Make "TODO" and "SKIP" case-insensitive

2020-03-16 Thread Daniel Shahaf
Daniel Shahaf wrote on Sun, Mar 15, 2020 at 18:59:29 +:
> P.S. I think there are at least two other bugs in tap.vim: (1) As
> mentioned above, TAP syntax is not highlighted unless there is an empty
> line above the plan line; (2) syntax/tap.vim sets various fold.* options
> globally, rather than locally and via an ftplugin.  However, let's keep
> this ticket about the skip case-sensitivity thing only.

For the curious, I worked around this by adding «autocmd FileType tap
syn clear tapTestInstructionsRegion tapTestRegion» to my .vimrc and
locally applying the patch from #954113.

> Please find attached a patch that lets those keywords be matched case
> insensitively:

That's still applicable.

Cheers,

Daniel



Bug#954016: vim-runtime: tap.vim: Make "TODO" and "SKIP" case-insensitive

2020-03-15 Thread Daniel Shahaf
Package: vim
Version: 2:8.2.0368-1
Severity: normal
Tags: patch upstream

Dear Maintainer,

   * What led up to the situation?

According to the TAP specification, the keywords "TODO" and "SKIP" are
case-insensitive:

https://testanything.org/tap-specification.html#directives
Directives are special notes that follow a # on the test line. Only
two are currently defined: TODO and SKIP. Note that these two
keywords are not case-sensitive.

   * What exactly did you do (or not do) that was effective (or
 ineffective)?

Please find attached a patch that lets those keywords be matched case
insensitively:

[[[
diff --git a/runtime/syntax/tap.vim b/runtime/syntax/tap.vim
index db37bb8..10b1f1e 100644
--- a/runtime/syntax/tap.vim
+++ b/runtime/syntax/tap.vim
@@ -29,12 +29,12 @@ syn match tapTestStatusOK /ok/ contained
 syn match tapTestStatusNotOK /not ok/ contained
 
 " highlight todo tests
-syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained 
contains=tapTestTodoRev
-syn match tapTestTodoRev /\/ contained
+syn match tapTestTodo /\c\(# TODO\|Failed (TODO)\) .*$/ contained 
contains=tapTestTodoRev
+syn match tapTestTodoRev /\c\/ contained
 
 " highlight skipped tests
-syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag
-syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained
+syn match tapTestSkip /\c# skip .*$/ contained contains=tapTestSkipTag
+syn match tapTestSkipTag /\c\(# \)\@<=skip\>/ contained
 
 " look behind so "ok 123" and "not ok 124" match test number
 syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained
]]]

Here is a test file where the behaviour change may be observed:

[[[
$ cat test.tap
# make sure to have an empty line above the plan line!

1..3
ok 1
ok 2 # TODO foo
ok 3 # SKIP bar
$ 
]]]

Thanks,

Daniel

P.S. I think there are at least two other bugs in tap.vim: (1) As
mentioned above, TAP syntax is not highlighted unless there is an empty
line above the plan line; (2) syntax/tap.vim sets various fold.* options
globally, rather than locally and via an ftplugin.  However, let's keep
this ticket about the skip case-sensitivity thing only.