@@ -20,7 +20,7 @@ import (
2020 "fmt"
2121 "os"
2222 "path/filepath"
23- "runtime "
23+ "strings "
2424 "testing"
2525)
2626
@@ -73,34 +73,15 @@ func (o *MarkdownOutput) printf(format string, args ...interface{}) {
7373 }
7474}
7575
76- // createMarkdownOutput creates a MarkdownOutput that writes to a file based on the test's name and location .
76+ // createMarkdownOutput creates a MarkdownOutput that writes to a file based on the test's name.
7777func createMarkdownOutput (t * testing.T ) OutputSink {
78- // Get file path and other info from the current caller frame (depth 0)
79- _ , testFilename , _ , ok := runtime .Caller (2 )
80- if ! ok {
81- t .Fatal ("Could not get test caller" )
82- }
83- _ , baseFilename , _ , ok := runtime .Caller (1 )
84- if ! ok {
85- t .Fatal ("Could not get test caller" )
86- }
87-
88- baseDir := filepath .Dir (baseFilename )
89-
90- testRelativePath , err := filepath .Rel (baseDir , testFilename )
91- if err != nil {
92- t .Fatalf ("failed to get relative path: %v" , err )
93- }
94-
95- testRelativeDir := filepath .Dir (testRelativePath )
96-
9778 artifactsDir := os .Getenv ("ARTIFACTS" )
9879 if artifactsDir == "" {
9980 artifactsDir = "_artifacts"
10081 }
101- outputBase := filepath .Join (artifactsDir , "ai-conformance" )
10282
103- outputPath := filepath .Join (outputBase , testRelativeDir , t .Name ()+ ".md" )
83+ testName := strings .ReplaceAll (t .Name (), "/" , "_" )
84+ outputPath := filepath .Join (artifactsDir , "tests" , testName , "output.md" )
10485
10586 if err := os .MkdirAll (filepath .Dir (outputPath ), 0755 ); err != nil {
10687 t .Fatalf ("failed to create output directory %v: %v" , filepath .Dir (outputPath ), err )
0 commit comments