*** Settings ***
Documentation    Smoke tests for built-in git tools
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Git Status Tool
    [Documentation]    Show working tree status using builtin/git-status
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    status    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-status-ok

Git Diff Tool
    [Documentation]    Show changes using builtin/git-diff
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    diff    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-diff-ok

Git Log Tool
    [Documentation]    Show commit log using builtin/git-log
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    log    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-log-ok

Git Blame Tool
    [Documentation]    Show file attribution using builtin/git-blame
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    blame    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-blame-ok

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