Files
coucou/scripts/test-claude-response.sh
Ramzi Alashmali efc80c3f59 Preserve all Claude response text and block boundaries
Both macOS response handlers selected only the first assistant text block,
which can be a web-search preamble instead of the actual answer. Reuse a
Foundation-only extractor to keep every text block in order while retaining
the complete content array in conversation history.

Concatenate without inserted separators so citation boundaries do not add
line breaks within sentences or corrupt fragmented JSON. Trim only the
combined outer edges, following Anthropic's SDK text-concatenation policy.

Add 24 regression cases, enforce Swift 6 and warnings as errors in the new
runner, retain upstream CI suites, and document the fix in Unreleased.

Validated with Swift 6.4 on Windows: 24 helper cases and 14 source-derived
handler cases pass; the original handlers reproduce five expected failures.
The handler harness uses UI/state stand-ins. Native macOS build and live
API validation remain pending.
2026-10-07 12:10:28 +03:00

10 lines
376 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-claude-response.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc -swift-version 6 -warnings-as-errors \
NotchBuddy/Sources/App/ClaudeResponseText.swift \
tests/ClaudeResponseTextTests.swift -o "$TEST_DIR/claude-response-tests"
"$TEST_DIR/claude-response-tests"