MCPcopy Create free account
hub / github.com/github/gh-aw / TestGeneratePromptRemovesXMLComments

Function TestGeneratePromptRemovesXMLComments

pkg/workflow/xml_comments_test.go:219–251  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestGeneratePromptRemovesXMLComments(t *testing.T) {
220 compiler := NewCompiler()
221
222 // Note: With the hybrid runtime-import approach, workflows without imports use runtime-import
223 // which means generatePrompt emits a runtime-import macro, not inline content
224 // XML comments are removed at runtime by runtime_import.cjs
225 data := &WorkflowData{
226 MarkdownContent: `# Workflow Title
227
228This is some content.
229<!-- This comment should be removed from the prompt -->
230More content here.
231
232<!-- Another comment
233that spans multiple lines
234should also be removed -->
235
236Final content.`,
237 ImportedFiles: []string{}, // No imports, so will use runtime-import
238 ImportInputs: nil,
239 }
240
241 var yaml strings.Builder
242 compiler.generatePrompt(&yaml, data, false, nil)
243
244 output := yaml.String()
245
246 // With runtime-import (no imports), the output should contain the runtime-import macro
247 // XML comments will be removed at runtime by runtime_import.cjs
248 if !strings.Contains(output, "{{#runtime-import") {
249 t.Error("Expected runtime-import macro in prompt generation output for workflow without imports")
250 }
251}
252
253func TestSplitContentIntoChunks(t *testing.T) {
254 // Test short content - should result in single chunk

Callers

nothing calls this directly

Calls 4

generatePromptMethod · 0.95
NewCompilerFunction · 0.85
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected