Replace path package with filepath
This commit is contained in:
parent
d6f1f28db8
commit
cab3cc63bf
8 changed files with 35 additions and 43 deletions
|
|
@ -3,13 +3,13 @@ package file
|
|||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Exists expects file to exist on path constructed from pathElems and returns content of the file
|
||||
func Exists(t *testing.T, pathElems ...string) (fileContent string) {
|
||||
modelFilePath := path.Join(pathElems...)
|
||||
modelFilePath := filepath.Join(pathElems...)
|
||||
file, err := os.ReadFile(modelFilePath) // #nosec G304
|
||||
require.Nil(t, err)
|
||||
require.NotEmpty(t, file)
|
||||
|
|
@ -18,7 +18,7 @@ func Exists(t *testing.T, pathElems ...string) (fileContent string) {
|
|||
|
||||
// NotExists expects file not to exist on path constructed from pathElems
|
||||
func NotExists(t *testing.T, pathElems ...string) {
|
||||
modelFilePath := path.Join(pathElems...)
|
||||
modelFilePath := filepath.Join(pathElems...)
|
||||
_, err := os.ReadFile(modelFilePath) // #nosec G304
|
||||
require.True(t, os.IsNotExist(err))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,18 +12,18 @@ import (
|
|||
"github.com/go-jet/jet/v2/tests/dbconfig"
|
||||
file2 "github.com/go-jet/jet/v2/tests/internal/utils/file"
|
||||
"github.com/stretchr/testify/require"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const tempTestDir = "./.tempTestDir"
|
||||
|
||||
var defaultModelPath = path.Join(tempTestDir, "dvds/model")
|
||||
var defaultActorModelFilePath = path.Join(tempTestDir, "dvds/model", "actor.go")
|
||||
var defaultTableSQLBuilderFilePath = path.Join(tempTestDir, "dvds/table")
|
||||
var defaultViewSQLBuilderFilePath = path.Join(tempTestDir, "dvds/view")
|
||||
var defaultEnumSQLBuilderFilePath = path.Join(tempTestDir, "dvds/enum")
|
||||
var defaultActorSQLBuilderFilePath = path.Join(tempTestDir, "dvds/table", "actor.go")
|
||||
var defaultModelPath = filepath.Join(tempTestDir, "dvds/model")
|
||||
var defaultActorModelFilePath = filepath.Join(tempTestDir, "dvds/model", "actor.go")
|
||||
var defaultTableSQLBuilderFilePath = filepath.Join(tempTestDir, "dvds/table")
|
||||
var defaultViewSQLBuilderFilePath = filepath.Join(tempTestDir, "dvds/view")
|
||||
var defaultEnumSQLBuilderFilePath = filepath.Join(tempTestDir, "dvds/enum")
|
||||
var defaultActorSQLBuilderFilePath = filepath.Join(tempTestDir, "dvds/table", "actor.go")
|
||||
|
||||
func dbConnection(dbName string) mysql2.DBConnection {
|
||||
if sourceIsMariaDB() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package postgres
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/go-jet/jet/v2/generator/metadata"
|
||||
|
|
@ -20,13 +20,13 @@ import (
|
|||
|
||||
const tempTestDir = "./.tempTestDir"
|
||||
|
||||
var defaultModelPath = path.Join(tempTestDir, "jetdb/dvds/model")
|
||||
var defaultSqlBuilderPath = path.Join(tempTestDir, "jetdb/dvds/table")
|
||||
var defaultActorModelFilePath = path.Join(tempTestDir, "jetdb/dvds/model", "actor.go")
|
||||
var defaultTableSQLBuilderFilePath = path.Join(tempTestDir, "jetdb/dvds/table")
|
||||
var defaultViewSQLBuilderFilePath = path.Join(tempTestDir, "jetdb/dvds/view")
|
||||
var defaultEnumSQLBuilderFilePath = path.Join(tempTestDir, "jetdb/dvds/enum")
|
||||
var defaultActorSQLBuilderFilePath = path.Join(tempTestDir, "jetdb/dvds/table", "actor.go")
|
||||
var defaultModelPath = filepath.Join(tempTestDir, "jetdb/dvds/model")
|
||||
var defaultSqlBuilderPath = filepath.Join(tempTestDir, "jetdb/dvds/table")
|
||||
var defaultActorModelFilePath = filepath.Join(tempTestDir, "jetdb/dvds/model", "actor.go")
|
||||
var defaultTableSQLBuilderFilePath = filepath.Join(tempTestDir, "jetdb/dvds/table")
|
||||
var defaultViewSQLBuilderFilePath = filepath.Join(tempTestDir, "jetdb/dvds/view")
|
||||
var defaultEnumSQLBuilderFilePath = filepath.Join(tempTestDir, "jetdb/dvds/enum")
|
||||
var defaultActorSQLBuilderFilePath = filepath.Join(tempTestDir, "jetdb/dvds/table", "actor.go")
|
||||
|
||||
var dbConnection = postgres.DBConnection{
|
||||
Host: dbconfig.PgHost,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue