From 25b113355b9a5d4aeaf65fd880745641c035838c Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Fri, 2 Dec 2022 00:30:44 -0800 Subject: [PATCH] nogo: Add a test to exercise base configs. --- tests/core/nogo/custom/custom_test.go | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/core/nogo/custom/custom_test.go b/tests/core/nogo/custom/custom_test.go index 72f3a3731..276244311 100644 --- a/tests/core/nogo/custom/custom_test.go +++ b/tests/core/nogo/custom/custom_test.go @@ -297,6 +297,24 @@ func run(pass *analysis.Pass) (interface{}, error) { } } +-- baseconfig.json -- +{ + "_base": { + "exclude_files": { + "has_.*\\.go": "Visibility analyzer not specified. Still inherits this special exception." + } + }, + "importfmt": { + "only_files": { + "has_errors\\.go": "" + } + }, + "foofuncname": { + "description": "no exemptions since we know this check is 100% accurate, so override base config", + "exclude_files": {} + } +} + -- has_errors.go -- package haserrors @@ -418,6 +436,18 @@ func Test(t *testing.T) { excludes: []string{ `importfmt`, }, + }, { + desc: "custom_config_with_base_linedirective", + config: "baseconfig.json", + target: "//:has_errors_linedirective", + wantSuccess: false, + includes: []string{ + `linedirective_foofuncname.go:.*function must not be named Foo \(foofuncname\)`, + `linedirective_visibility.go:.*function D is not visible in this package \(visibility\)`, + }, + excludes: []string{ + `importfmt`, + }, }, { desc: "uses_cgo_with_errors", config: "config.json",