Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNORE level results only show in debug mode #148

Merged
merged 2 commits into from
Sep 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test code
  • Loading branch information
tomoyamachi committed Sep 10, 2021
commit 8b2353000e3a811d8a8091ce2ee5f21e0f9d3fc9
24 changes: 23 additions & 1 deletion pkg/types/assessment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func TestCreateAssessmentMap(t *testing.T) {
testcases := map[string]struct {
as AssessmentSlice
ig map[string]struct{}
debug bool
expected AssessmentMap
}{
"OK": {
Expand Down Expand Up @@ -48,6 +49,27 @@ func TestCreateAssessmentMap(t *testing.T) {
{Code: "a", Filename: "b"},
},
ig: map[string]struct{}{"b": {}},
expected: map[string]CodeInfo{
"a": {
Code: "a",
Level: 0,
Assessments: []*Assessment{
{Code: "a", Filename: "a"},
{Code: "a", Filename: "c"},
{Code: "a", Filename: "b"},
},
},
},
},
"IgnoreBwithDebug": {
as: AssessmentSlice{
{Code: "a", Filename: "a"},
{Code: "b", Filename: "b"},
{Code: "a", Filename: "c"},
{Code: "a", Filename: "b"},
},
ig: map[string]struct{}{"b": {}},
debug: true,
expected: map[string]CodeInfo{
"a": {
Code: "a",
Expand All @@ -70,7 +92,7 @@ func TestCreateAssessmentMap(t *testing.T) {
}

for name, v := range testcases {
actual := CreateAssessmentMap(v.as, v.ig)
actual := CreateAssessmentMap(v.as, v.ig, v.debug)
cmpopts := []cmp.Option{
cmpopts.SortSlices(func(x, y Assessment) bool {
if x.Code == y.Code {
Expand Down