예제 #1
0
def test_has_command_custom_commands(state):
    with setup_workspace():
        update_bash_history_info()
        has_command(state,
                    "(a|b)+",
                    "a and b are the best letters",
                    commands=["old command"])
예제 #2
0
def test_prepare_validation(state):
    state.force_diagnose = True
    with setup_workspace():
        update_bash_history_info()
        prepare_validation(state, ["ls", "echo abc"])
        has_command(state, "ls", "good job")
        has_command(state, "echo.*c", "well done")
예제 #3
0
def test_has_command_fixed(state):
    with setup_workspace() as (bash_history_path, bash_history_info_path):
        update_bash_history_info()
        Path(bash_history_path.name).write_text("(a|b)+")
        has_command(state,
                    "(a|b)+",
                    "a and b are the best letters",
                    fixed=True)
예제 #4
0
def test_has_command_failure(state):
    with setup_workspace() as (bash_history_path, bash_history_info_path):
        update_bash_history_info()
        Path(bash_history_path.name).write_text("wrong")
        with pytest.raises(TF, match="a and b"):
            has_command(state, "(a|b)+", "a and b are the best letters")
예제 #5
0
def test_has_command_no_commands(state):
    with setup_workspace():
        update_bash_history_info()
        with pytest.raises(TF, match="didn't find any"):
            has_command(state, "(a|b)+", "a and b are the best letters")