mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-13 02:17:25 +01:00
Start to integrate file based testing
This commit is contained in:
parent
5a09277d1c
commit
9299f65993
@ -4,22 +4,26 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
package repository_test
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"bytes"
|
||||
"go/format"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHandleImportFlag(t *testing.T) {
|
||||
r := setupRepo(t)
|
||||
|
||||
paths, err := filepath.Glob(filepath.Join("testdata", "*.input"))
|
||||
tests, err := filepath.Glob(filepath.Join("testdata", "*.input"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
for _, path := range tests {
|
||||
_, filename := filepath.Split(path)
|
||||
testname := filename[:len(filename)-len(filepath.Ext(path))]
|
||||
|
||||
// Each path turns into a test: the test name is the filename without the
|
||||
// extension.
|
||||
t.Run(testname, func(t *testing.T) {
|
||||
source, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
@ -47,10 +51,6 @@ func TestHandleImportFlag(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s := "../../test/repo/meta1.json:../../test/repo/data1.json"
|
||||
err := HandleImportFlag(s)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user