this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

listests: add RelativeDirectory format option

+15 -4
+15 -4
listests/main.go
··· 12 12 "iter" 13 13 "os" 14 14 "os/signal" 15 + "path/filepath" 15 16 "slices" 16 17 "strconv" 17 18 "strings" ··· 113 114 114 115 for test := range iterTests(tests) { 115 116 cwd, _ := os.Getwd() 116 - relativePath := fmt.Sprintf(".%v", strings.TrimPrefix(test.File, cwd)) 117 + relativePath, err := filepath.Rel(cwd, test.File) 118 + if err != nil { 119 + return fmt.Errorf("failed to get relative file path: %w", err) 120 + } 121 + 122 + relativeDir, err := filepath.Rel(cwd, test.Directory) 123 + if err != nil { 124 + return fmt.Errorf("failed to get relative directory: %w", err) 125 + } 117 126 templateData := struct { 118 127 TestInfo 119 - RelativeFileName string 128 + RelativeFileName string 129 + RelativeDirectory string 120 130 }{ 121 - TestInfo: *test, 122 - RelativeFileName: relativePath, 131 + TestInfo: *test, 132 + RelativeFileName: relativePath, 133 + RelativeDirectory: relativeDir, 123 134 } 124 135 125 136 var buf bytes.Buffer