From 60d836d3726332d1a13cf2e62806471ccbdb5e50 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 13 Aug 2020 14:48:49 +0200 Subject: executor: fix style checking test The regexp for empty suppressions matches _everything_... Don't match suppression if it's empty. --- executor/style_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'executor/style_test.go') 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 -- cgit mrf-deployment