Skip to content

Commit 24269e9

Browse files
authored
Merge pull request #175 from Sanchit2662/feat/cel-language-constant
feat(reporthandling): add CELLanguage constant for CEL rule evaluation
2 parents 104126f + 30c9688 commit 24269e9

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

reporthandling/datastructures.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type RuleLanguages string
1414
const (
1515
RegoLanguage RuleLanguages = "Rego"
1616
RegoLanguage2 RuleLanguages = "rego"
17+
CELLanguage RuleLanguages = "CEL"
1718
)
1819

1920
// RuleMatchObjects defines which objects this rule applied on

reporthandling/datastructures_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,20 @@ func TestMockPostureReportA(t *testing.T) {
8484
}
8585

8686
}
87+
88+
func TestRuleLanguagesConstants(t *testing.T) {
89+
tests := []struct {
90+
name string
91+
language RuleLanguages
92+
expected string
93+
}{
94+
{"Rego (capitalized)", RegoLanguage, "Rego"},
95+
{"rego (lowercase)", RegoLanguage2, "rego"},
96+
{"CEL", CELLanguage, "CEL"},
97+
}
98+
for _, tt := range tests {
99+
t.Run(tt.name, func(t *testing.T) {
100+
assert.Equal(t, tt.expected, string(tt.language))
101+
})
102+
}
103+
}

0 commit comments

Comments
 (0)