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

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

        x = [
           sort([-1, 3, 2]),
           sort([1, 2, -1]),
           sort([1, -1, 2, -1]),           
           sort([]),
           sort({3, 2, 1}),
           sort(set())
        ]

        r {false}
        u1 = sort(r)
    query: data.test
    want_result:
      x:
        - [-1, 2, 3]
        - [-1, 1, 2]
        - [-1, -1, 1, 2]
        - []
        - [1, 2, 3]
        - []
      
  - note: invalid-null
    data: {}
    modules: ["package test\n x= sort(null)"]
    query: data.test
    error: "`sort` requires array/set argument."
        
  - note: invalid-bool
    data: {}
    modules: ["package test\n x= sort(true)"]
    query: data.test
    error: "`sort` requires array/set argument."

  - note: invalid-number
    data: {}
    modules: ["package test\n x= sort(5)"]
    query: data.test
    error: "`sort` requires array/set argument."
    
  - note: invalid-string
    data: {}
    modules: ["package test\n x= sort(`abc`)"]
    query: data.test
    error: "`sort` requires array/set argument."
    
  - note: invalid-object
    data: {}
    modules: ["package test\n x= sort({})"]
    query: data.test
    error: "`sort` requires array/set argument."
