Repository navigation
Expand file tree
/
Copy pathbindings_ext.textproto
More file actions
102 lines (101 loc) · 2.01 KB
/
Copy pathbindings_ext.textproto
File metadata and controls
102 lines (101 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto
# proto-message: cel.expr.conformance.test.SimpleTestFile
name: "bindings_ext"
description: "Tests for the bindings extension library."
section: {
name: "bind"
test: {
name: "boolean_literal"
expr: "cel.bind(t, true, t)"
value: {
bool_value: true
}
}
test: {
name: "string_concat"
expr: "cel.bind(msg, \"hello\", msg + msg + msg)"
value: {
string_value: "hellohellohello"
}
}
test: {
name: "bind_nested"
expr: "cel.bind(t1, true, cel.bind(t2, true, t1 && t2))"
value: {
bool_value: true
}
}
test: {
name: "macro_exists"
expr: "cel.bind(valid_elems, [1, 2, 3], [3, 4, 5].exists(e, e in valid_elems))"
value: {
bool_value: true
}
}
test: {
name: "macro_not_exists"
expr: "cel.bind(valid_elems, [1, 2, 3], ![4, 5].exists(e, e in valid_elems))"
value: {
bool_value: true
}
}
test: {
name: "shadowing"
expr: "cel.bind(x, 0, x == 0)"
type_env: {
name: "x"
ident: {
type: { primitive: INT64 }
}
}
bindings: {
key: "x"
value: {
value: { int64_value: 1 }
}
}
value: {
bool_value: true
}
}
test: {
name: "shadowing_namespace_resolution"
expr: "cel.bind(x, 0, x == 0)"
container: "com.example"
type_env: {
name: "com.example.x"
ident: {
type: { primitive: INT64 }
}
}
bindings: {
key: "com.example.x"
value: {
value: { int64_value: 1 }
}
}
value: {
bool_value: true
}
}
test: {
name: "shadowing_namespace_resolution_selector"
expr: "cel.bind(x, {'y': 0}, x.y == 0)"
container: "com.example"
type_env: {
name: "com.example.x.y"
ident: {
type: { primitive: INT64 }
}
}
bindings: {
key: "com.example.x.y"
value: {
value: { int64_value: 1 }
}
}
value: {
bool_value: true
}
}
}