示例#1
0
def test_command_quoting(capsys):
    """
    Verify commands are escaped properly
    """
    pane = Pane("identity", "fake_window", SPLIT_VERTICAL)
    pane.set_command("foo")

    expected = {}
    actual = {}
    expected["command1"] = '"foo" "C-m"'
    actual["command1"] = pane.command

    pane.set_command("foo", False)
    expected["command2"] = '"foo"'
    actual["command2"] = pane.command

    pane.set_command('echo "foo"')
    expected["command3"] = '"echo \\"foo\\"" "C-m"'
    actual["command3"] = pane.command

    pane.set_command("echo 'foo'")
    expected["command4"] = '"echo \'foo\'" "C-m"'
    actual["command4"] = pane.command

    pane.set_command('"echo \\"things\\"" "C-m"')
    expected["already_quoted"] = '"echo \\"things\\"" "C-m"'
    actual["already_quoted"] = pane.command

    assert_objects_equal(expected, actual, expected.keys(), capsys)
示例#2
0
def test_get_command(capsys):
    """
    Verify getting the command works
    """
    pane = Pane("identity", "fake_window", SPLIT_VERTICAL)

    expected = {"none": ""}
    actual = {"none": pane.get_run_command()}

    pane.set_command("foo")
    expected["cmd"] = 'send-keys "foo" "C-m"'
    actual["cmd"] = pane.get_run_command()

    assert_objects_equal(expected, actual, expected.keys(), capsys)