*** Settings ***
Documentation    Smoke tests for inline tool executor
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Execute Simple Inline Tool
    [Documentation]    Execute inline tool and capture output
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    execute-simple    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    inline-execute-ok

Execute Inline Tool With Timeout
    [Documentation]    Inline tool times out with structured error
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    execute-timeout    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    inline-timeout-ok

Execute Inline Tool With Truncation
    [Documentation]    Inline tool output is truncated at max size
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    execute-truncate    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    inline-truncate-ok

Validate Inline Tool Missing Code
    [Documentation]    Validation detects missing code
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate-no-code    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    inline-validate-ok

Write Guard Blocks Read Only
    [Documentation]    Write guard prevents execution in read-only context
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    write-guard    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    inline-guard-ok
