---
cases:
  - data:
      a:
        - 1
        - 2
        - 3
        - 4
      b:
        v1: hello
        v2: goodbye
      c:
        - x:
            - true
            - false
            - foo
          "y":
            - null
            - 3.14159
          z:
            p: true
            q: false
      d:
        e:
          - bar
          - baz
      f:
        - xs:
            - 1
          ys:
            - 2
        - xs:
            - 2
          ys:
            - 3
      g:
        a:
          - 1
          - 0
          - 0
          - 0
        b:
          - 0
          - 2
          - 0
          - 0
        c:
          - 0
          - 0
          - 0
          - 4
      h:
        - - 1
          - 2
          - 3
        - - 2
          - 3
          - 4
      l:
        - a: bob
          b: -1
          c:
            - 1
            - 2
            - 3
            - 4
        - a: alice
          b: 1
          c:
            - 2
            - 3
            - 4
            - 5
          d: null
      m: []
      numbers:
        - "1"
        - "2"
        - "3"
        - "4"
      strings:
        bar: 2
        baz: 3
        foo: 1
      three: 3
    modules:
      - |
        package test

        samepkg = y {
          data.test.foo("how do you do?", y)
        }
      - |
        package test.l1.l3

        g(__local20__) = __local20__
      - |
        package test.l1.l2

        p = true

        f(__local21__) = __local21__
      - |
        package test.omit_result

        f(__local22__) = __local22__

        p {
          data.test.omit_result.f(1)
        }
      - |
        package ex

        foo(__local0__) = y {
          split(__local0__, "i", y)
        }

        bar[x] = y {
          data.l[_].a = x
          data.ex.foo(x, y)
        }

        chain0(__local1__) = y {
          data.ex.foo(__local1__, y)
        }

        chain1(__local2__) = b {
          data.ex.chain0(__local2__, b)
        }

        chain2 = d {
          data.ex.chain1("fooibar", d)
        }

        cross(__local3__) = [a, b] {
          split(__local3__, "i", y)
          __local27__ = y[1]
          data.ex.foo(__local27__, b)
          __local28__ = y[2]
          data.test.foo(__local28__, a)
        }

        falsy_func(__local4__) = false

        falsy_func_else(__local5__) {
          __local5__ = 1
        }

        else = false {
          true
        }

        falsy_undefined {
          data.ex.falsy_func(1)
        }

        falsy_negation {
          not data.ex.falsy_func(1)
        }

        falsy_else_value = __local23__ {
          true
          data.ex.falsy_func_else(2, __local23__)
        }

        falsy_else_undefined {
          data.ex.falsy_func_else(2)
        }

        falsy_else_negation {
          not data.ex.falsy_func_else(2)
        }

        arrays([__local7__, __local8__]) = [a, b] {
          data.ex.foo(__local7__, a)
          data.ex.foo(__local8__, b)
        }

        arraysrule = y {
          data.ex.arrays(["hih", "foo"], y)
        }

        objects({"foo": __local9__, "bar": __local10__}) = z {
          data.ex.foo(__local9__, a)
          data.test.foo(__local10__, b)
          z = [a, b]
        }

        objectsrule = y {
          data.ex.objects({"bar": "hi ho", "foo": "hih"}, y)
        }

        refoutput = y {
          data.ex.foo("hih", z)
          y = z[1]
        }

        void(__local11__) {
          __local11__ = "foo"
        }

        voidGood {
          not data.ex.void("bar", true)
        }

        voidBad {
          data.ex.void("bar", true)
        }

        multi(1, __local12__) = y {
          y = __local12__
        }

        multi(2, __local13__) = y {
          __local24__ = 2 * __local13__
          a = __local24__
          __local25__ = a + 1
          y = __local25__
        }

        multi(3, __local14__) = y {
          __local26__ = __local14__ * 10
          y = __local26__
        }

        multi("foo", __local15__) = y {
          y = "bar"
        }

        multi1 = y {
          data.ex.multi(1, 2, y)
        }

        multi2 = y {
          data.ex.multi(2, 2, y)
        }

        multi3 = y {
          data.ex.multi(3, 2, y)
        }

        multi4 = y {
          data.ex.multi("foo", 2, y)
        }

        always_true_fn(__local16__) = true

        always_true {
          data.ex.always_true_fn(1)
        }
      - |
        package test

        foo(__local17__) = y {
          trim(__local17__, "h o", y)
        }

        cross = y {
          data.ex.cross("hi, my name is foo", y)
        }

        multi("foo", __local18__) = y {
          y = __local18__
        }

        multi("bar", __local19__) = y {
          y = "baz"
        }

        multi_cross_pkg = [y, z] {
          data.test.multi("foo", "bar", y)
          data.ex.multi(2, 1, z)
        }
    note: functions/basic call
    query: data.ex.bar.alice = x
    want_result:
      - x:
          - al
          - ce
