*** Settings ***
Documentation    Fixture: a tdd_expected_fail test whose teardown fails.
...              Verifies the listener's teardown guard keeps the FAIL
...              status instead of inverting when cleanup breaks.
...              Tagged with ``tdd_fixture`` so the main Robot suites do
...              not execute it directly.

*** Keywords ***
Failing Teardown Keyword
    [Documentation]    Simulates a teardown failure occurring after the
    ...    test body has already passed.
    Fail    Teardown failed: resource cleanup crashed

*** Test Cases ***
Bug 997 Teardown Error Should Not Be Inverted
    [Tags]    tdd_issue    tdd_issue_997    tdd_expected_fail    tdd_fixture
    [Documentation]    This test exercises a teardown failure. The listener
    ...    should detect the teardown failure and skip inversion — the FAIL
    ...    result must remain intact.
    Log    Test body execution should still run before teardown.
    Should Be Equal As Integers    1    1
    [Teardown]    Failing Teardown Keyword
