diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-08-13 14:48:49 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-08-13 15:37:26 +0200 |
| commit | 60d836d3726332d1a13cf2e62806471ccbdb5e50 (patch) | |
| tree | d2a3ea5ac4c45360fec8b1f4fa34e8d1085af826 /executor/style_test.go | |
| parent | cc59e7e4adf110e2ddd4f8ae57df8ecc7b369b38 (diff) | |
executor: fix style checking test
The regexp for empty suppressions matches _everything_...
Don't match suppression if it's empty.
Diffstat (limited to 'executor/style_test.go')
| -rw-r--r-- | executor/style_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/executor/style_test.go b/executor/style_test.go index c3fde4889..9e09709ff 100644 --- a/executor/style_test.go +++ b/executor/style_test.go @@ -73,13 +73,13 @@ if (foo) supp := regexp.MustCompile(check.suppression) for _, match := range re.FindAllIndex(data, -1) { start, end := match[0], match[1] - for start != 0 && data[start-1] != '\n' { + for check.pattern[0] != '\n' && start != 0 && data[start-1] != '\n' { start-- } - for end != len(data) && data[end] != '\n' { + for check.pattern[len(check.pattern)-1] != '\n' && end != len(data) && data[end] != '\n' { end++ } - if supp.Match(data[start:end]) { + if check.suppression != "" && supp.Match(data[start:end]) { continue } line := bytes.Count(data[:start], []byte{'\n'}) + 1 |
