Exemplo n.º 1
0
def test_repl_remains_running_despite_errors():
    Helpers.test_chain(
        _given_a_repl_with_mocked_streams, _when_an_error_is_thrown,
        _input_is_evaluated_and_output_is_displayed([
            ("", ""),
            ("\n", ""),
            (integer(10), "10"),
            (integer(20), "20"),
            (invoke(symbol("+"), integer(1), integer(2)), "3"),
        ]))
Exemplo n.º 2
0
def test_repl_evaluates_input_and_displays_it():
    Helpers.test_chain(
        _given_a_repl_with_mocked_streams,
        _input_is_evaluated_and_output_is_displayed([
            ("", ""),
            ("\n", ""),
            (integer(10), "10"),
            (integer(20), "20"),
            (invoke(symbol("+"), integer(1), integer(2)), "3"),
        ]))
Exemplo n.º 3
0
def test_repl_uses_standard_input_and_output_by_default():
    Helpers.test_chain(_given_a_real_repl, _default_input_is_used,
                       _default_output_is_used)
Exemplo n.º 4
0
def test_repl_prompts_for_input_on_every_tick():
    Helpers.test_chain(_given_a_repl_with_mocked_streams, _tick_many_times,
                       _input_used_once_per_tick)
Exemplo n.º 5
0
def test_repl_displays_prompt_on_every_tick():
    Helpers.test_chain(_given_a_repl_with_mocked_streams,
                       _prompt_is_printed_on_each_tick,
                       _output_used_at_least_the_number_of_ticks)
Exemplo n.º 6
0
def test_repl_displays_welcome_message_on_first_tick_only():
    Helpers.test_chain(_given_a_repl_with_mocked_streams, _tick,
                       _output_used_at_least_once,
                       _output_usage_increases_linearly_with_each_tick)