Files
drharness/tests/test_edit_prompt_with_context.sh
hal9000 da919f9f6e Merge origin/master into work branch (issue #169)
Resolved merge conflicts:
- CMakeLists.txt: Added both rebase_engine/utility and base64_util sources
- src/harness.cpp: Combined Content type with proper error handling
- src/main.cpp: Merged includes, test flags, and CLI parsing
  - Renamed conflicting flags: -B→-Z (build_rebase), -T→-W (edit_prompt), -b→-K (base64_decode)
- tests/CMakeLists.txt: Added all test targets from both branches
- src/rebase_engine.cpp: Fixed to use get_content_string() for Content variant type
- Updated test files to use new flag names (-Z, -W, -K)
2026-06-15 22:52:29 +00:00

47 lines
1.2 KiB
Bash

#!/bin/bash
# test_edit_prompt_with_context.sh - Test edit message with previous message context
test_name="edit_with_context"
# Two messages: editing message 1, so message 0 should be shown as context
json=$(create_history_json user "hello" assistant "hi there")
OUTPUT=$("${DRHARNESS}" -W "$json" "1" "assistant")
# Check for previous message context
if ! echo "$OUTPUT" | grep -q "# Previous message:"; then
echo "FAIL: $test_name - missing previous message header"
echo "Got: $OUTPUT"
exit 1
fi
# Check for index 0 in context
if ! echo "$OUTPUT" | grep -q "\[0\] user: hello"; then
echo "FAIL: $test_name - missing context message with index"
echo "Got: $OUTPUT"
exit 1
fi
# Check for separator
if ! echo "$OUTPUT" | grep -q -- "-- >8 --"; then
echo "FAIL: $test_name - missing separator"
echo "Got: $OUTPUT"
exit 1
fi
# Check for edit prompt
if ! echo "$OUTPUT" | grep -q "Edit message 1 (role: assistant) below:"; then
echo "FAIL: $test_name - missing edit prompt"
echo "Got: $OUTPUT"
exit 1
fi
# Check for current content
if ! echo "$OUTPUT" | grep -q "hi there"; then
echo "FAIL: $test_name - missing current content"
echo "Got: $OUTPUT"
exit 1
fi
echo "PASS: $test_name"