Debian Codegraph @

tests/languages/rego/function_feature.test

raw
1 object.remove({"a": {"b": {"c": 2}}, "x": 123}, {"a": 1}) == {"x": 123}
2
3 output := is_set(x)
4 output := intersection(set[set])
5 output := regex.match(pattern, value)
6 output := glob.match("*.github.com", [], "api.github.com")
7 output := bits.rsh(x, s)
8 output := io.jwt.verify_ps384(string, certificate)
9
10 io.jwt.encode_sign({
11 "typ": "JWT",
12 "alg": "HS256"},
13 {}, {
14 "kty": "oct",
15 "k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow"
16 })
17
18 ----------------------------------------------------
19
20 [
21 ["function", [
22 ["namespace", "object"],
23 ["punctuation", "."],
24 "remove"
25 ]],
26 ["punctuation", "("],
27 ["punctuation", "{"],
28 ["property", "\"a\""],
29 ["operator", ":"],
30 ["punctuation", "{"],
31 ["property", "\"b\""],
32 ["operator", ":"],
33 ["punctuation", "{"],
34 ["property", "\"c\""],
35 ["operator", ":"],
36 ["number", "2"],
37 ["punctuation", "}"],
38 ["punctuation", "}"],
39 ["punctuation", ","],
40 ["property", "\"x\""],
41 ["operator", ":"],
42 ["number", "123"],
43 ["punctuation", "}"],
44 ["punctuation", ","],
45 ["punctuation", "{"],
46 ["property", "\"a\""],
47 ["operator", ":"],
48 ["number", "1"],
49 ["punctuation", "}"],
50 ["punctuation", ")"],
51 ["operator", "=="],
52 ["punctuation", "{"],
53 ["property", "\"x\""],
54 ["operator", ":"],
55 ["number", "123"],
56 ["punctuation", "}"],
57
58 "\r\n\r\noutput ",
59 ["operator", ":="],
60 ["function", ["is_set"]],
61 ["punctuation", "("],
62 "x",
63 ["punctuation", ")"],
64
65 "\r\noutput ",
66 ["operator", ":="],
67 ["function", ["intersection"]],
68 ["punctuation", "("],
69 "set",
70 ["punctuation", "["],
71 "set",
72 ["punctuation", "]"],
73 ["punctuation", ")"],
74
75 "\r\noutput ",
76 ["operator", ":="],
77 ["function", [
78 ["namespace", "regex"],
79 ["punctuation", "."],
80 "match"
81 ]],
82 ["punctuation", "("],
83 "pattern",
84 ["punctuation", ","],
85 " value",
86 ["punctuation", ")"],
87
88 "\r\noutput ",
89 ["operator", ":="],
90 ["function", [
91 ["namespace", "glob"],
92 ["punctuation", "."],
93 "match"
94 ]],
95 ["punctuation", "("],
96 ["string", "\"*.github.com\""],
97 ["punctuation", ","],
98 ["punctuation", "["],
99 ["punctuation", "]"],
100 ["punctuation", ","],
101 ["string", "\"api.github.com\""],
102 ["punctuation", ")"],
103
104 "\r\noutput ",
105 ["operator", ":="],
106 ["function", [
107 ["namespace", "bits"],
108 ["punctuation", "."],
109 "rsh"
110 ]],
111 ["punctuation", "("],
112 "x",
113 ["punctuation", ","],
114 " s",
115 ["punctuation", ")"],
116
117 "\r\noutput ",
118 ["operator", ":="],
119 ["function", [
120 ["namespace", "io"],
121 ["punctuation", "."],
122 ["namespace", "jwt"],
123 ["punctuation", "."],
124 "verify_ps384"
125 ]],
126 ["punctuation", "("],
127 "string",
128 ["punctuation", ","],
129 " certificate",
130 ["punctuation", ")"],
131
132 ["function", [
133 ["namespace", "io"],
134 ["punctuation", "."],
135 ["namespace", "jwt"],
136 ["punctuation", "."],
137 "encode_sign"
138 ]],
139 ["punctuation", "("],
140 ["punctuation", "{"],
141
142 ["property", "\"typ\""],
143 ["operator", ":"],
144 ["string", "\"JWT\""],
145 ["punctuation", ","],
146
147 ["property", "\"alg\""],
148 ["operator", ":"],
149 ["string", "\"HS256\""],
150 ["punctuation", "}"],
151 ["punctuation", ","],
152
153 ["punctuation", "{"],
154 ["punctuation", "}"],
155 ["punctuation", ","],
156 ["punctuation", "{"],
157
158 ["property", "\"kty\""],
159 ["operator", ":"],
160 ["string", "\"oct\""],
161 ["punctuation", ","],
162
163 ["property", "\"k\""],
164 ["operator", ":"],
165 ["string", "\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\""],
166
167 ["punctuation", "}"],
168 ["punctuation", ")"]
169 ]
170
171 ----------------------------------------------------
172
173 Checks for all functions.