Skip to content

Commit 59d185f

Browse files
authored
Merge pull request #456 from symflower/in-source-prompt
Let the "write-tests" prompt ask to extend the given source file in case tests should be next to the source
2 parents 5d5eb2a + 3cbfc55 commit 59d185f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

evaluate/task/test-integration/task_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func TestWriteTestsRun(t *testing.T) {
109109

110110
Setup: func(t *testing.T) {
111111
var query any = bytesutil.StringTrimIndentations(`
112-
Given the following Rust code file "src/plain.rs", provide tests for this code.
112+
Given the following Rust code file "src/plain.rs", provide tests for this code that can be appended to the source file.
113113
The tests should produce 100 percent code coverage and must compile.
114114
The response must contain only the test code in a fenced code block and nothing else.
115115

model/llm/llm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ type llmWriteTestSourceFilePromptContext struct {
148148

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(`
151-
Given the following {{ .Language.Name }} code file "{{ .FilePath }}" {{- with .ImportPath }} with package "{{ . }}" {{- end }}, provide {{- if .HasTestsInSource }} tests {{ else }} a test file {{ end -}} for this code{{ with .TestFramework }} with {{ . }} as a test framework{{ end }}.
151+
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 -}}.
152152
The tests should produce 100 percent code coverage and must compile.
153153
The response must contain only the test code in a fenced code block and nothing else.
154154

model/llm/llm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ func TestFormatPromptContext(t *testing.T) {
708708
},
709709

710710
ExpectedMessage: bytesutil.StringTrimIndentations(`
711-
Given the following Rust code file "path/to/main.rs", provide tests for this code.
711+
Given the following Rust code file "path/to/main.rs", provide tests for this code that can be appended to the source file.
712712
The tests should produce 100 percent code coverage and must compile.
713713
The response must contain only the test code in a fenced code block and nothing else.
714714

0 commit comments

Comments
 (0)