{
  "schema": "https://bars.commonsware.com/conformance/schema/render-fixture.schema.json",
  "version": "0.1.0",
  "cases": [
    {
      "name": "sort-numbers",
      "spotlight": true,
      "description": "A list of numbers is sorted in ascending numeric order.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": [
          3,
          1,
          2
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[1,2,3]"
      }
    },
    {
      "name": "sort-strings",
      "description": "A list of strings is sorted in ascending lexicographic order.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": [
          "banana",
          "apple",
          "cherry"
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[\"apple\",\"banana\",\"cherry\"]"
      }
    },
    {
      "name": "sort-by-numeric-property",
      "spotlight": true,
      "description": "With a property argument, structs are sorted by that numeric property.",
      "template": "{{ items | sort: \"n\" }}",
      "context": {
        "items": [
          {
            "n": 3
          },
          {
            "n": 1
          },
          {
            "n": 2
          }
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[{\"n\":1},{\"n\":2},{\"n\":3}]"
      }
    },
    {
      "name": "sort-by-string-property",
      "description": "With a property argument, structs are sorted by that string property.",
      "template": "{{ items | sort: \"k\" }}",
      "context": {
        "items": [
          {
            "k": "b"
          },
          {
            "k": "a"
          }
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[{\"k\":\"a\"},{\"k\":\"b\"}]"
      }
    },
    {
      "name": "sort-empty-list",
      "description": "Sorting an empty list yields an empty list.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": []
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[]"
      }
    },
    {
      "name": "sort-mixed-types-is-null",
      "description": "A list mixing numbers and strings is not uniformly comparable, so the result is null.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": [
          1,
          "a",
          2
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "null"
      }
    },
    {
      "name": "sort-non-primitive-contents-is-null",
      "description": "Without a property, struct elements are not primitive keys, so the result is null.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": [
          {
            "a": 1
          },
          {
            "a": 2
          }
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "null"
      }
    },
    {
      "name": "sort-property-non-struct-is-null",
      "description": "With a property, non-struct elements cannot supply the key, so the result is null.",
      "template": "{{ xs | sort: \"n\" }}",
      "context": {
        "xs": [
          1,
          2
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "null"
      }
    },
    {
      "name": "sort-property-missing-is-null",
      "description": "With a property, a struct missing that property cannot supply the key, so the result is null.",
      "template": "{{ items | sort: \"n\" }}",
      "context": {
        "items": [
          {
            "n": 1
          },
          {
            "m": 2
          }
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "null"
      }
    },
    {
      "name": "sort-non-list-is-null",
      "description": "sort operates only on lists; a string input yields null.",
      "template": "{{ x | sort }}",
      "context": {
        "x": "hi"
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "null"
      }
    },
    {
      "name": "sort-two-args-is-error",
      "description": "More than one argument is an arity error.",
      "template": "{{ xs | sort: \"a\" \"b\" }}",
      "context": {
        "xs": [
          1
        ]
      },
      "expect": {
        "kind": "error",
        "errorCode": "KB-2002"
      }
    },
    {
      "name": "sort-strings-code-point-order",
      "description": "String ordering is by Unicode code point, so a BMP private-use character sorts before an astral character even though UTF-16 code-unit order would put the astral character's leading surrogate first.",
      "template": "{{ xs | sort }}",
      "context": {
        "xs": [
          "😀",
          ""
        ]
      },
      "expect": {
        "kind": "output",
        "expectedOutput": "[\"\",\"😀\"]"
      }
    }
  ]
}
