# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cases:
  - note: simple
    data: {}
    modules:
      - |
        package test

        x = { k:1 | k = ["Hello", "world", 1][_] }
    query: data.test
    want_result:
      x:
        object!:
          - key: "Hello"
            value: 1
          - key: "world"
            value: 1
          - key: 1
            value: 1


  - note: key-loop
    data: {}
    modules:
      - |
        package test

        x = { ["Hello", "world", 1][_]:1 | true }
    query: data.test
    want_result:
      x:
        object!:
          - key: "Hello"
            value: 1
          - key: "world"
            value: 1
          - key: 1
            value: 1

  - note: multiple-occurance-of-same-key-value-pair
    data: {}
    modules:
      - |
        package test
        x = { k:v | k = ["Hello", "world", 1][_]; v = [1, 1][_] }
    query: data.test
    want_result:
      x:
        object!:
          - key: "Hello"
            value: 1
          - key: "world"
            value: 1
          - key: 1
            value: 1

  - note: different-values-for-same-key
    data: {}
    modules:
      - |
        package test
        x = { k:v | k = ["Hello", "world", 1][_]; v = [1, 2][_] }
    query: data.test
    error: "value for key `\"Hello\"` generated multiple times: `1` and `2`"
