4
4
"context"
5
5
"io/fs"
6
6
"os"
7
+ "path"
7
8
"strings"
8
9
"sync"
9
10
"testing"
@@ -73,7 +74,7 @@ func buildTestImportFile(t *testing.T, filename string) testImportFile {
73
74
func TestImportFile (t * testing.T ) {
74
75
directory := "./testdata/import_file"
75
76
for _ , file := range getTestFiles (directory , t ) {
76
- tc := buildTestImportFile (t , directory + "/" + file .Name ())
77
+ tc := buildTestImportFile (t , path . Join ( directory , file .Name () ))
77
78
t .Run (tc .description , func (t * testing.T ) {
78
79
defer os .Remove ("module.river" )
79
80
require .NoError (t , os .WriteFile ("module.river" , []byte (tc .module ), 0664 ))
@@ -100,7 +101,7 @@ func TestImportFile(t *testing.T) {
100
101
func TestImportString (t * testing.T ) {
101
102
directory := "./testdata/import_string"
102
103
for _ , file := range getTestFiles (directory , t ) {
103
- archive , err := txtar .ParseFile (directory + "/" + file .Name ())
104
+ archive , err := txtar .ParseFile (path . Join ( directory , file .Name () ))
104
105
require .NoError (t , err )
105
106
t .Run (archive .Files [0 ].Name , func (t * testing.T ) {
106
107
testConfig (t , string (archive .Files [0 ].Data ), "" , nil )
@@ -133,7 +134,7 @@ func buildTestImportError(t *testing.T, filename string) testImportError {
133
134
func TestImportError (t * testing.T ) {
134
135
directory := "./testdata/import_error"
135
136
for _ , file := range getTestFiles (directory , t ) {
136
- tc := buildTestImportError (t , directory + "/" + file .Name ())
137
+ tc := buildTestImportError (t , path . Join ( directory , file .Name () ))
137
138
t .Run (tc .description , func (t * testing.T ) {
138
139
testConfigError (t , tc .main , strings .TrimRight (tc .expectedError , "\n " ))
139
140
})
0 commit comments