---
cases:
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /c
        - /a
    want_result:
      - x: true
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /f
        - /a
    want_result: []
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /b/c
        - /d
    want_result:
      - x: true
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /a
        - e/f/g
    want_result:
      - x: true
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - aa/bb/cc
        - aa/bb/dd
        - ee/ff/gg
      suffixes:
        - b/cc
        - f/g
    want_result:
      - x: true
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - aa/bb/cc
        - aa/bb/dd
        - ee/ff/gg
      suffixes:
        - b/c
        - f/g
    want_result: []
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - aa/bb/cc
        - aa/bb/dd
        - ee/ff/gg
      suffixes:
        - aa/b
    want_result: []
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings: []
      suffixes:
        - a/b
        - e/f
    want_result: []
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes: []
    want_result: []
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffixes)
        }
    input:
      strings: []
      suffixes: []
    want_result: []
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffix)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffix: /c
    want_result:
      - x: true
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.suffix)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffix: /h
    want_result: []
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.string, input.suffixes)
        }
    input:
      string: a/b/c
      suffixes:
        - /c
        - /a
    want_result:
      - x: true
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.string, input.suffixes)
        }
    input:
      string: a/b/g
      suffixes:
        - /c
        - /a
    want_result: []
  - note: strings/any_suffix_match/match
    query: data.test.p = x
    modules:
      - |
        package test

        strings_set contains str if {
        	str := input.strings[_]
        }

        suffixes_set contains suffix if {
        	suffix := input.suffixes[_]
        }

        p if {
        	strings.any_suffix_match(strings_set, suffixes_set)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /c
        - /a
    want_result:
      - x: true
  - note: strings/any_suffix_match/nomatch
    query: data.test.p = x
    modules:
      - |
        package test

        strings_set contains str if {
        	str := input.strings[_]
        }

        suffixes_set contains suffix if {
        	suffix := input.suffixes[_]
        }

        p if {
        	strings.any_suffix_match(strings_set, suffixes_set)
        }
    input:
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
      suffixes:
        - /f
        - /a
    want_result: []
  - note: strings/any_suffix_match/type_error_nostrict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - f/
        - d/
      strings:
        - 1
        - 2
        - 3
    want_result: []
  - note: strings/any_suffix_match/type_error_nostrict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - f/
        - d/
      strings: 1
    want_result: []
  - note: strings/any_suffix_match/type_error_nostrict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - 1
        - 2
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
    want_result: []
  - note: strings/any_suffix_match/type_error_nostrict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes: 1
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
    want_result: []
  - note: strings/any_suffix_match/type_error_strict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - f/
        - d/
      strings:
        - 1
        - 2
        - 3
    want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 1 must be array of strings but got array containing number"
    strict_error: true
  - note: strings/any_suffix_match/type_error_strict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - f/
        - d/
      strings: 1
    want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 1 must be one of {string, set, array} but got number"
    strict_error: true
  - note: strings/any_suffix_match/type_error_strict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes:
        - 1
        - 2
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
    want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 2 must be array of strings but got array containing number"
    strict_error: true
  - note: strings/any_suffix_match/type_error_strict
    query: data.test.p = x
    modules:
      - |
        package test

        p if {
        	strings.any_suffix_match(input.strings, input.prefixes)
        }
    input:
      prefixes: 1
      strings:
        - a/b/c
        - a/b/d
        - e/f/g
    want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 2 must be one of {string, set, array} but got number"
    strict_error: true
