Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions conformance/testdata/nested_rules_variable_shadowing/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: nested_rules_variable_shadowing
variables:
- name: x
type_name: int
34 changes: 34 additions & 0 deletions conformance/testdata/nested_rules_variable_shadowing/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: nested_rules_variable_shadowing
rule:
variables:
- name: i
expression: '1'
- name: j
expression: '2'
match:
- condition: "x == 1"
rule:
variables:
- name: i
expression: "5"
match:
- output: "variables.i + variables.j"
- condition: "x == 2"
rule:
match:
- output: "variables.i + variables.j"
- output: "variables.i + variables.j"
36 changes: 36 additions & 0 deletions conformance/testdata/nested_rules_variable_shadowing/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

description: "Nested rule tests for rule variable shadowing"
section:
- name: "shadowing"
tests:
- name: "shadowed"
input:
x:
expr: "1"
output:
expr: "7"
- name: "neighbor_rule"
input:
x:
expr: "2"
output:
expr: "3"
- name: "parent_rule"
input:
x:
expr: "3"
output:
expr: "3"
8 changes: 8 additions & 0 deletions conformance/testdata/unconditional_rules/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: unconditional_rules
variables:
- name: a
type_name: bool
- name: b
type_name: bool
- name: c
type_name: bool
30 changes: 30 additions & 0 deletions conformance/testdata/unconditional_rules/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: unconditional_rules
rule:
match:
- condition: "a"
rule:
match:
- rule:
match:
- condition: "b"
output: "1"
- output: "2"
- rule:
match:
- condition: "c"
output: "3"
- output: "4"
58 changes: 58 additions & 0 deletions conformance/testdata/unconditional_rules/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

description: Unconditional rules propagation conformance tests
section:
- name: "composition"
tests:
- name: "case_a_true_b_true"
input:
a:
expr: "true"
b:
expr: "true"
c:
expr: "true"
output:
expr: "1"
- name: "case_a_true_b_false"
input:
a:
expr: "true"
b:
expr: "false"
c:
expr: "true"
output:
expr: "2"
- name: "case_a_false_c_true"
input:
a:
expr: "false"
b:
expr: "false"
c:
expr: "true"
output:
expr: "3"
- name: "case_a_false_c_false"
input:
a:
expr: "false"
b:
expr: "false"
c:
expr: "false"
output:
expr: "4"
18 changes: 18 additions & 0 deletions conformance/testdata/variable_type_propagation/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: variable_type_propagation
variables:
- name: x
type_name: int
23 changes: 23 additions & 0 deletions conformance/testdata/variable_type_propagation/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: variable_type_propagation
rule:
variables:
- name: empty_list
expression: '[]'
- name: string_list
expression: '["foo"]'
match:
- output: "variables.empty_list + [1]"
21 changes: 21 additions & 0 deletions conformance/testdata/variable_type_propagation/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

description: "Rule demonstrating variable types propagate independently"
section:
- name: "test"
tests:
- name: "types_agree"
output:
expr: "[1]"
Loading