Debian Codegraph @

tests/snippets/rego/test_for_all.txt

raw
1 ---input---
2 package example
3
4 # Rego Policy References: https://www.openpolicyagent.org/docs/latest/policy-reference/
5
6 # assert no values in set match predicate
7 count({x | set[x]; f(x)}) == 0
8
9 # assert all values in set make function f true
10 count({x | set[x]; f(x)}) == count(set)
11
12 # assert no values in set make function f true (using negation and helper rule)
13 not any_match
14
15 # assert all values in set make function f true (using negation and helper rule)
16 not any_not_match
17
18
19 # with `import rego.v1`, or `import future.keywords.in` and `import future.keywords.if`
20 any_match if {
21 some x in set
22 f(x)
23 }
24
25 any_not_match if {
26 some x in set
27 not f(x)
28 }
29
30 ---tokens---
31 'package' Keyword
32 ' ' Text.Whitespace
33 'example' Name
34 '\n' Text.Whitespace
35
36 '\n' Text.Whitespace
37
38 '# Rego Policy References: https://www.openpolicyagent.org/docs/latest/policy-reference/' Comment.Single
39 '\n' Text.Whitespace
40
41 '\n' Text.Whitespace
42
43 '# assert no values in set match predicate' Comment.Single
44 '\n' Text.Whitespace
45
46 'count' Name
47 '(' Punctuation
48 '{' Punctuation
49 'x' Name
50 ' ' Text.Whitespace
51 '|' Operator
52 ' ' Text.Whitespace
53 'set' Name
54 '[' Punctuation
55 'x' Name
56 ']' Punctuation
57 ';' Punctuation
58 ' ' Text.Whitespace
59 'f' Name
60 '(' Punctuation
61 'x' Name
62 ')' Punctuation
63 '}' Punctuation
64 ')' Punctuation
65 ' ' Text.Whitespace
66 '==' Operator
67 ' ' Text.Whitespace
68 '0' Literal.Number
69 '\n' Text.Whitespace
70
71 '\n' Text.Whitespace
72
73 '# assert all values in set make function f true' Comment.Single
74 '\n' Text.Whitespace
75
76 'count' Name
77 '(' Punctuation
78 '{' Punctuation
79 'x' Name
80 ' ' Text.Whitespace
81 '|' Operator
82 ' ' Text.Whitespace
83 'set' Name
84 '[' Punctuation
85 'x' Name
86 ']' Punctuation
87 ';' Punctuation
88 ' ' Text.Whitespace
89 'f' Name
90 '(' Punctuation
91 'x' Name
92 ')' Punctuation
93 '}' Punctuation
94 ')' Punctuation
95 ' ' Text.Whitespace
96 '==' Operator
97 ' ' Text.Whitespace
98 'count' Name
99 '(' Punctuation
100 'set' Name
101 ')' Punctuation
102 '\n' Text.Whitespace
103
104 '\n' Text.Whitespace
105
106 '# assert no values in set make function f true (using negation and helper rule)' Comment.Single
107 '\n' Text.Whitespace
108
109 'not' Keyword
110 ' ' Text.Whitespace
111 'any_match' Name
112 '\n' Text.Whitespace
113
114 '\n' Text.Whitespace
115
116 '# assert all values in set make function f true (using negation and helper rule)' Comment.Single
117 '\n' Text.Whitespace
118
119 'not' Keyword
120 ' ' Text.Whitespace
121 'any_not_match' Name
122 '\n' Text.Whitespace
123
124 '\n' Text.Whitespace
125
126 '\n' Text.Whitespace
127
128 '# with `import rego.v1`, or `import future.keywords.in` and `import future.keywords.if`' Comment.Single
129 '\n' Text.Whitespace
130
131 'any_match' Name
132 ' ' Text.Whitespace
133 'if' Keyword
134 ' ' Text.Whitespace
135 '{' Punctuation
136 '\n' Text.Whitespace
137
138 ' ' Text.Whitespace
139 'some' Keyword
140 ' ' Text.Whitespace
141 'x' Name
142 ' ' Text.Whitespace
143 'in' Keyword
144 ' ' Text.Whitespace
145 'set' Name
146 '\n' Text.Whitespace
147
148 ' ' Text.Whitespace
149 'f' Name
150 '(' Punctuation
151 'x' Name
152 ')' Punctuation
153 '\n' Text.Whitespace
154
155 '}' Punctuation
156 '\n' Text.Whitespace
157
158 '\n' Text.Whitespace
159
160 'any_not_match' Name
161 ' ' Text.Whitespace
162 'if' Keyword
163 ' ' Text.Whitespace
164 '{' Punctuation
165 '\n' Text.Whitespace
166
167 ' ' Text.Whitespace
168 'some' Keyword
169 ' ' Text.Whitespace
170 'x' Name
171 ' ' Text.Whitespace
172 'in' Keyword
173 ' ' Text.Whitespace
174 'set' Name
175 '\n' Text.Whitespace
176
177 ' ' Text.Whitespace
178 'not' Keyword
179 ' ' Text.Whitespace
180 'f' Name
181 '(' Punctuation
182 'x' Name
183 ')' Punctuation
184 '\n' Text.Whitespace
185
186 '}' Punctuation
187 '\n' Text.Whitespace