diff --git a/pkg/dsl/parser/parser_test.go b/pkg/dsl/parser/parser_test.go index 36e2f8a22..df6e5a521 100644 --- a/pkg/dsl/parser/parser_test.go +++ b/pkg/dsl/parser/parser_test.go @@ -1007,5 +1007,39 @@ rule confidentiality_level_low(confidentiality_level double) { _, err := pr.Parse() Expect(err).ShouldNot(HaveOccurred()) }) + + It("Case 28 - Multi-line Permission Expression w/ Rule", func() { + pr := NewParser(` + entity account { + relation owner @user + relation admin @user + + permission withdraw = admin or + owner + } + `) + + _, err := pr.Parse() + Expect(err).ShouldNot(HaveOccurred()) + }) + + It("Case 29 - Multi-line Permission Expression w/ Rule - should fail", func() { + pr := NewParser(` + entity account { + relation owner @user + relation admin @user + + permission withdraw = admin + or owner + } + `) + + _, err := pr.Parse() + // Ensure an error is returned + Expect(err).Should(HaveOccurred()) + + // Ensure the error message contains the expected string + Expect(err.Error()).Should(ContainSubstring("7:15:expected token to be RELATION, PERMISSION, ATTRIBUTE, got OR instead")) + }) }) })