From a1a45f5368637b0b0ff5afb3188191647a0bd3ad Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Tue, 1 Aug 2023 14:40:00 +0300 Subject: [PATCH] [#6] noliteral: fix tests Signed-off-by: Alexander Chuprov --- internal/analyzers/noliteral/linter_test.go | 4 +++- internal/analyzers/noliteral/test-case/src/negative._go | 9 --------- internal/analyzers/noliteral/test-case/src/positive._go | 4 ---- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/internal/analyzers/noliteral/linter_test.go b/internal/analyzers/noliteral/linter_test.go index b82b05e..e528e08 100644 --- a/internal/analyzers/noliteral/linter_test.go +++ b/internal/analyzers/noliteral/linter_test.go @@ -12,6 +12,8 @@ import ( ) func TestAnalyzer_negative(t *testing.T) { + const countNegativeCases = 4 + _, filename, _, _ := runtime.Caller(0) dir := filepath.Dir(filename) @@ -32,7 +34,7 @@ func TestAnalyzer_negative(t *testing.T) { _, err = run(pass) - if Count != 6 { + if Count != countNegativeCases { t.Fail() } if err != nil { diff --git a/internal/analyzers/noliteral/test-case/src/negative._go b/internal/analyzers/noliteral/test-case/src/negative._go index d0ffe85..5f06b70 100644 --- a/internal/analyzers/noliteral/test-case/src/negative._go +++ b/internal/analyzers/noliteral/test-case/src/negative._go @@ -17,15 +17,6 @@ func (c *cfg) error_n() { c.log.Error("logs.MSG") //unacceptable } -func (c *cfg) reportFlushError_n() { - c.log.reportFlushError("logs.MSG") //unacceptable -} - -func (c *cfg) reportError_n() { - c.log.reportError("logs.MSG") //unacceptable -} - - type Logger interface { Debug(msg string) diff --git a/internal/analyzers/noliteral/test-case/src/positive._go b/internal/analyzers/noliteral/test-case/src/positive._go index b23bd24..79a895a 100644 --- a/internal/analyzers/noliteral/test-case/src/positive._go +++ b/internal/analyzers/noliteral/test-case/src/positive._go @@ -24,10 +24,6 @@ func (c *cfg) custom_ok_lit() { c.log.Abyr("logs.MSG") //acceptable } -func (c *cfg) custom_ok_lit() { - log.Abyr("logs.MSG") //acceptable -} - type Logger interface { Debug(msg string) Info(msg string)