Split test_edit_history_flag.sh into individual test scripts (issue 125)

This commit is contained in:
2026-06-02 16:16:42 -05:00
parent 0366d3db57
commit aa04ad0902
6 changed files with 103 additions and 2 deletions
+6 -2
View File
@@ -63,8 +63,12 @@ add_dr_test(test_rebase_apply)
# Add edit prompt tests
add_dr_test(test_edit_prompt)
# Add edit history flag tests
add_dr_test(test_edit_history_flag)
# Add edit history flag tests (split from test_edit_history_flag.sh)
add_dr_test(test_edit_history_flag_requires_F_short)
add_dr_test(test_edit_history_flag_requires_F_long)
add_dr_test(test_edit_history_flag_empty_file_short)
add_dr_test(test_edit_history_flag_no_history)
add_dr_test(test_edit_history_flag_empty_file_long)
# Add edit history integration tests (split into individual tests)
add_dr_test(test_edit_history_pick_all_messages)
@@ -0,0 +1,17 @@
#!/bin/bash
# test_edit_history_flag_empty_file_long.sh - Test that --edit-history with empty file fails
# Create empty file
> empty_chat.json
set +e
OUTPUT=$("${DRHARNESS}" --edit-history -F empty_chat.json 2>&1)
EXIT_CODE=$?
set -e
if [ ${EXIT_CODE} -eq 0 ]; then
echo "FAIL: expected non-zero exit code, got 0"
exit 1
fi
echo "PASS: edit_history_flag_empty_file_long"
@@ -0,0 +1,17 @@
#!/bin/bash
# test_edit_history_flag_empty_file_short.sh - Test that -b with empty file fails
# Create empty file
> empty_chat.json
set +e
OUTPUT=$("${DRHARNESS}" -b -F empty_chat.json 2>&1)
EXIT_CODE=$?
set -e
if [ ${EXIT_CODE} -eq 0 ]; then
echo "FAIL: expected non-zero exit code, got 0"
exit 1
fi
echo "PASS: edit_history_flag_empty_file_short"
@@ -0,0 +1,23 @@
#!/bin/bash
# test_edit_history_flag_no_history.sh - Test that -b with no history fails
# Create file with valid JSON but empty history
create_chat_file no_history.json
set +e
OUTPUT=$("${DRHARNESS}" -b -F no_history.json 2>&1)
EXIT_CODE=$?
set -e
if [ ${EXIT_CODE} -eq 0 ]; then
echo "FAIL: expected non-zero exit code, got 0"
exit 1
fi
if ! echo "$OUTPUT" | grep -q "no history"; then
echo "FAIL: expected error message about no history"
echo "Output was: $OUTPUT"
exit 1
fi
echo "PASS: edit_history_flag_no_history"
@@ -0,0 +1,20 @@
#!/bin/bash
# test_edit_history_flag_requires_F_long.sh - Test that --edit-history without -F fails
set +e
OUTPUT=$("${DRHARNESS}" --edit-history 2>&1)
EXIT_CODE=$?
set -e
if [ ${EXIT_CODE} -eq 0 ]; then
echo "FAIL: expected non-zero exit code, got 0"
exit 1
fi
if ! echo "$OUTPUT" | grep -q "requires -F"; then
echo "FAIL: expected error message about -F requirement"
echo "Output was: $OUTPUT"
exit 1
fi
echo "PASS: edit_history_flag_requires_F_long"
@@ -0,0 +1,20 @@
#!/bin/bash
# test_edit_history_flag_requires_F_short.sh - Test that -b without -F fails
set +e
OUTPUT=$("${DRHARNESS}" -b 2>&1)
EXIT_CODE=$?
set -e
if [ ${EXIT_CODE} -eq 0 ]; then
echo "FAIL: expected non-zero exit code, got 0"
exit 1
fi
if ! echo "$OUTPUT" | grep -q "requires -F"; then
echo "FAIL: expected error message about -F requirement"
echo "Output was: $OUTPUT"
exit 1
fi
echo "PASS: edit_history_flag_requires_F_short"