def test_task_microagent_match_trigger():
    """Test that a task microagent matches its trigger correctly."""
    content = """---
name: test_task
version: 1.0.0
author: openhands
agent: CodeActAgent
triggers:
- /test_task
inputs:
  - name: TEST_VAR
    description: "Test variable"
---

This is a test task microagent.
"""

    with tempfile.NamedTemporaryFile(suffix='.md') as f:
        f.write(content.encode())
        f.flush()

        agent = BaseMicroagent.load(f.name)

        assert isinstance(agent, TaskMicroagent)
        assert agent.match_trigger('/test_task') == '/test_task'
        assert agent.match_trigger('  /test_task  ') == '/test_task'
        assert agent.match_trigger('This contains /test_task') == '/test_task'
        assert agent.match_trigger('/other_task') is None
Test that a task microagent matches its trigger correctly.
tests/runtime/test_microagent.py