예제 #1
0
def test_error_handling(debugger_api: _DebuggerAPI):
    """
    This is an integrated test of the debug adapter. It communicates with it as if it was
    VSCode.
    """
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import TerminatedEvent
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import Response
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import Request

    debugger_api.initialize()
    target = debugger_api.get_dap_case_file("case_log.robot")

    debugger_api.launch(target, debug=True)

    # Let's write some invalid messages...
    debugger_api.write({})
    response = debugger_api.read(Response)
    assert not response.success

    debugger_api.write(Request("invalid_command"))
    response = debugger_api.read(Response)
    assert not response.success

    debugger_api.set_breakpoints(target, 4)
    debugger_api.configuration_done()

    debugger_api.wait_for_thread_stopped()

    debugger_api.continue_event()

    debugger_api.read(TerminatedEvent)
예제 #2
0
def test_invalid_launch_1(debugger_api: _DebuggerAPI):
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import LaunchRequest
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import LaunchRequestArguments
    from robocorp_ls_core.debug_adapter_core.dap.dap_schema import Response

    debugger_api.initialize()

    debugger_api.write(
        LaunchRequest(
            LaunchRequestArguments(
                __sessionId="some_id",
                noDebug=True,
                # target=target, -- error: don't add target
                terminal="none",
                cwd=None,
            )))

    launch_response = debugger_api.read(Response)
    assert launch_response.success == False