[
  {
    "description": "Simple command",
    "command": "echo A",
    "expected":
    {
      "result": "A"
    }
  },

  {
    "description": "Simple command with parameter",
    "command": "echo '${zzz}'",
    "params": {"zzz": "Boom"},
    "expected":
    {
      "result": "Boom"
    }
  },

  {
    "description": "List of commands",
    "command": ["echo A", "echo B", "echo C"],
    "expected":
    {
      "result": ["A", "B", "C"]
    }
  },

  {
    "description": "List of commands with parameters",
    "command": ["echo A-${abc}", "echo B-${abc}", "echo C-${xyz}", "echo D-${xyz}"],
    "params": {"abc": "123", "xyz": "789"},
    "expected":
    {
      "result": ["A-123", "B-123", "C-789", "D-789"]
    }
  },

  {
    "description": "Named list of commands",
    "command": {"Letter A": "echo A", "Letter B": "echo B", "Letter C": "echo C"},
    "expected":
    {
      "result": ["Letter A: A", "Letter B: B", "Letter C: C"]
    }
  },

  {
    "description": "Named list with single member",
    "command": {"Letter A": "echo A"},
    "expected":
    {
      "result": "Letter A: A"
    }
  },

  {
    "description": "Prefixed commands",
    "command": ["A", "B", "C"],
    "options": {"cmdPrefix": "echo prefixed"},
    "expected":
    {
      "result": ["prefixed A", "prefixed B", "prefixed C"]
    }
  },

  {
    "description": "Prefixed with variables",
    "command": ["A-${abc}", "B", "C+${abc}"],
    "params": {"abc": "123"},
    "options": {"cmdPrefix": "echo ${abc}=prefixed"},
    "expected":
    {
      "result": ["123=prefixed A-123", "123=prefixed B", "123=prefixed C+123"]
    }
  },

  {
    "description": "List of commands with boolean parameters",
    "command": ["echo A:${ok}", "echo B:${not}:${ok}", "echo C:${not}"],
    "params": {"ok": true, "not": false},
    "expected":
    {
      "result": ["A:1", "B::1", "C:"]
    }
  },

  {
    "description": "List of commands with `undefined` and `null` parameters",
    "command": ["echo A:${no}:", "echo B:${nay}:", "echo C:${never}:"],
    "params": {"no": "undefined", "nay": null, "never": ""},
    "expected":
    {
      "result": ["A::", "B::", "C::"]
    }
  },

  {
    "description": "Makes sure default shell is not the same with custom test shell",
    "command": "echo $0",
    "expected":
    {
      "result": "/bin/sh"
    }
  },

  {
    "description": "Reads custom shell from global options",
    "executioner":
    {
      "options": {"shell": "/bin/bash"}
    },
    "command": "echo $0",
    "expected":
    {
      "result": "/bin/bash"
    }
  },

  {
    "description": "Custom shell as command options",
    "command": "echo $0",
    "options": {"shell": "/bin/bash"},
    "expected":
    {
      "result": "/bin/bash"
    }
  },

  {
    "description": "List of commands with non-primitive parameter value",
    "command": ["echo A:${arr}"],
    "params": {"pre": "pre", "arr": [1, 2, 3], "brr": "legit"},
    "expected":
    {
      "error":
      {
        "message": "Parameters should be a primitive value."
      }
    }
  },

  {
    "description": "One-liner with erroneous result",
    "command": "echo ABC && echo XYZ 1>&2 && false",
    "expected":
    {
      "error":
      {
        "message": "Command failed: echo ABC && echo XYZ 1>&2 && false\nXYZ",
        "stdout": "ABC",
        "stderr": "XYZ"
      }
    }
  },

  {
    "description": "Set of commands with erroneous member. Reads custom shell from global options",
    "executioner":
    {
      "options": {"shell": "/bin/bash"}
    },
    "command": ["echo ABC", "echo XYZ 1>&2", "false", "not executed"],
    "expected":
    {
      "error":
      {
        "message": "Command failed: false",
        "stdout": "",
        "stderr": ""
      }
    }
  },

  {
    "description": "Simple command with erroneous result",
    "command": "false",
    "options": {"shell": "/bin/bash"},
    "expected":
    {
      "error":
      {
        "message": "Command failed: false"
      }
    }
  },

  {
    "description": "Simple command with erroneous result. Handles no global options",
    "executioner":
    {
      "options": null
    },
    "command": "false",
    "expected":
    {
      "error":
      {
        "message": "Command failed: false"
      }
    }
  },

  {
    "description": "Simple command with falsy options",
    "command": "echo OK",
    "options": false,
    "expected":
    {
      "result": "OK"
    }
  },

  {
    "description": "Terminates ongoing process",
    "command": "echo Z; sleep 1; echo A",
    "expected":
    {
      "error":
      {
        "terminated": true
      },
      "result": "Z"
    },
    "terminate": 100
  },

  {
    "description": "When `terminate` called without proper job object, it does nothing",
    "terminate": 0
  },

  {
    "description": "Preserves prefix upon termination, terminates ongoing process",
    "command": {"died": "echo X; sleep 1; echo B"},
    "expected":
    {
      "error":
      {
        "terminated": true
      },
      "result": "died: X"
    },
    "terminate": 100
  },

  {
    "description": "Terminates set of commands mid flight",
    "command": ["echo 123", "echo A; sleep 1; echo Z", "echo 789", "never gets a chance"],
    "expected":
    {
      "error":
      {
        "terminated": true
      },
      "result": ["123", "A"]
    },
    "terminate": 100
  }

]
