From cc1a4df15c22f07ae35ed23e7e2f6c7ffbf772a3 Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Mon, 16 Jun 2025 20:36:26 +0700 Subject: [PATCH] Add test for `xml code block scenario - Add specific test case for `xml code blocks containing log_message directives - Test passes, confirming the implementation handles this scenario correctly in tests - However, runtime behavior still differs from test behavior --- .../__tests__/directive-streaming-parser.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts b/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts index 32f17e12ab..51aa245d9d 100644 --- a/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts +++ b/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts @@ -123,4 +123,18 @@ suite("DirectiveStreamingParser", () => { expect(result[0].type).toBe("text") expect(result[1].type).toBe("log_message") }) + + test("should not parse directives inside ```xml code blocks", () => { + const input = + "Here's the basic format:\n\n```xml\n\nThis is a debug message for detailed troubleshooting information\ndebug\n\n```\n\nThat should be treated as code." + const result = DirectiveStreamingParser.parse(input) + expect(result).toEqual([ + { + type: "text", + content: + "Here's the basic format:\n\n```xml\n\nThis is a debug message for detailed troubleshooting information\ndebug\n\n```\n\nThat should be treated as code.", + partial: true, + } as TextDirective, + ]) + }) })