Skip to content

Commit e5dcf53

Browse files
committed
Clarify appending in Rust write-test prompt
1 parent 59d185f commit e5dcf53

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

model/llm/llm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ type llmWriteTestSourceFilePromptContext struct {
149149
// llmWriteTestForFilePromptTemplate is the template for generating an LLM test generation prompt.
150150
var llmWriteTestForFilePromptTemplate = template.Must(template.New("model-llm-write-test-for-file-prompt").Parse(bytesutil.StringTrimIndentations(`
151151
Given the following {{ .Language.Name }} code file "{{ .FilePath }}" {{- with .ImportPath }} with package "{{ . }}" {{- end }}, {{- if .HasTestsInSource }} provide tests for this code that can be appended to the source file{{ else }} provide a test file for this code{{ with .TestFramework }} with {{ . }} as a test framework{{ end }}{{ end -}}.
152+
{{- if .HasTestsInSource }}
153+
Add everything required for testing, but do not repeat the original file and do not try to import the code file.
154+
{{- end }}
152155
The tests should produce 100 percent code coverage and must compile.
153156
The response must contain only the test code in a fenced code block and nothing else.
154157

model/llm/llm_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ func TestFormatPromptContext(t *testing.T) {
709709

710710
ExpectedMessage: bytesutil.StringTrimIndentations(`
711711
Given the following Rust code file "path/to/main.rs", provide tests for this code that can be appended to the source file.
712+
Add everything required for testing, but do not repeat the original file and do not try to import the code file.
712713
The tests should produce 100 percent code coverage and must compile.
713714
The response must contain only the test code in a fenced code block and nothing else.
714715

0 commit comments

Comments
 (0)