diff --git a/testing/src/test/resources/policy/late_function_binding/config.yaml b/testing/src/test/resources/policy/late_function_binding/config.yaml new file mode 100644 index 000000000..423db293b --- /dev/null +++ b/testing/src/test/resources/policy/late_function_binding/config.yaml @@ -0,0 +1,34 @@ +# Copyright 2025 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: "late_function_binding" +functions: + - name: "foo" + overloads: + - id: 'foo_id' + args: + - type_name: 'string' + return: + type_name: 'bool' + - name: "bar" + overloads: + - id: 'bar_id' + args: + - type_name: 'string' + return: + type_name: 'bool' +variables: + - name: "a" + type: + type_name: 'string' \ No newline at end of file diff --git a/testing/src/test/resources/policy/late_function_binding/policy.yaml b/testing/src/test/resources/policy/late_function_binding/policy.yaml new file mode 100644 index 000000000..15cc503e9 --- /dev/null +++ b/testing/src/test/resources/policy/late_function_binding/policy.yaml @@ -0,0 +1,20 @@ +# Copyright 2025 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: "late_function_binding" +rule: + match: + - condition: foo(a) || bar(a) + output: "true" + - output: "false" diff --git a/testing/src/test/resources/policy/late_function_binding/tests.yaml b/testing/src/test/resources/policy/late_function_binding/tests.yaml new file mode 100644 index 000000000..63cd3f092 --- /dev/null +++ b/testing/src/test/resources/policy/late_function_binding/tests.yaml @@ -0,0 +1,28 @@ +# Copyright 2025 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: "Tests for late function binding." +section: + - name: "late_function_binding" + tests: + - name: "true_by_default" + input: + a: + value: "foo" + output: "true" + - name: "false_by_default" + input: + a: + value: "baz" + output: "false" \ No newline at end of file