Files
drharness/tests/test_skill_override.sh

43 lines
1.2 KiB
Bash

#!/bin/bash
# test_skill_override.sh - Verifies that local skills override global skills with the same name
# Override HOME to ensure global skills are scanned within the isolated test directory
export HOME="$TEST_TEMP_DIR"
# Create global skill directory
mkdir -p "$HOME/.local/share/harness/skills/override_test"
cat > "$HOME/.local/share/harness/skills/override_test/SKILL.md" << 'SKILL'
---
name: override-test
description: Global Description
---
# Global Content
SKILL
# Create local skill directory
mkdir -p skills/override_test
cat > skills/override_test/SKILL.md << 'SKILL'
---
name: override-test
description: Local Description
---
# Local Content
SKILL
# Run drharness with -S flag
OUTPUT=$("${DRHARNESS}" -S -F dummy.chat)
# Verify output contains the LOCAL description, not global
if ! echo "$OUTPUT" | grep -q "override-test - Local Description"; then
echo "FAIL: Expected 'override-test - Local Description' in output"
exit 1
fi
# Ensure global description is NOT in output (it was overridden)
if echo "$OUTPUT" | grep -q "Global Description"; then
echo "FAIL: Global skill should have been overridden by local skill"
exit 1
fi
echo "PASS: skill_override"