*** Settings ***
Documentation    Smoke tests for skill-level file operation tools
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_skill_file_ops.py

*** Test Cases ***
Skill File Read
    [Documentation]    Read a file using skill/file-read
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    read    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-file-read-ok

Skill File Write Atomic
    [Documentation]    Write a file atomically using skill/file-write
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    write    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-file-write-ok

Skill File Edit
    [Documentation]    Edit a file using skill/file-edit
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    edit    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-file-edit-ok

Skill File Delete
    [Documentation]    Delete a file using skill/file-delete
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    delete    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-file-delete-ok

Skill File Binary Detection
    [Documentation]    Binary file detection rejects binary files
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    binary    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-binary-ok

Skill File Path Traversal
    [Documentation]    Path traversal should be blocked
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    traversal    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-traversal-ok
