*** Settings ***
Documentation    Integration tests for LSP config fields
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_lsp_config_fields.py

*** Test Cases ***
LspTransport Enum Values
    [Documentation]    LspTransport has stdio, tcp, pipe
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    transport-enum    cwd=${WORKSPACE}    on_timeout=kill    timeout=30s
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    transport-enum-ok

Config Default Values
    [Documentation]    New fields default correctly
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-defaults    cwd=${WORKSPACE}    on_timeout=kill    timeout=30s
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    config-defaults-ok

Config All Fields Populated
    [Documentation]    Config accepts all new fields
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-all-fields    cwd=${WORKSPACE}    on_timeout=kill    timeout=30s
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    config-all-fields-ok

Config Serialization Round Trip
    [Documentation]    New fields survive serialization
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-roundtrip    cwd=${WORKSPACE}    on_timeout=kill    timeout=30s
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    config-roundtrip-ok

Registry Preserves New Fields
    [Documentation]    Registry stores and retrieves new fields
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    registry-preserves    cwd=${WORKSPACE}    on_timeout=kill    timeout=30s
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    registry-preserves-ok
