aboutsummaryrefslogtreecommitdiff
path: root/spdxconv_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'spdxconv_test.go')
-rw-r--r--spdxconv_test.go42
1 files changed, 23 insertions, 19 deletions
diff --git a/spdxconv_test.go b/spdxconv_test.go
index 8a8e112..b58f7a0 100644
--- a/spdxconv_test.go
+++ b/spdxconv_test.go
@@ -227,21 +227,22 @@ func TestSPDXConv_scanDir(t *testing.T) {
dir string
exp []string
}
- t.Chdir(`testdata/`)
var listCase = []testCase{{
- dir: `scan/`,
+ dir: `testdata/scan/`,
exp: []string{
- `scan/.gitignore`,
- `scan/test.go`,
- `scan/test.html`,
- `scan/test.sh`,
+ `.gitignore`,
+ `a/b/.gitignore`,
+ `test.go`,
+ `test.html`,
+ `test.sh`,
+ `with_spdx.go`,
},
}, {
- dir: `scan_no_scm/`,
+ dir: `testdata/scan_no_scm/`,
exp: []string{
- `scan_no_scm/test.go`,
- `scan_no_scm/test.html`,
- `scan_no_scm/test.sh`,
+ `test.go`,
+ `test.html`,
+ `test.sh`,
},
}}
var tc testCase
@@ -249,14 +250,17 @@ func TestSPDXConv_scanDir(t *testing.T) {
var err error
var got []string
for _, tc = range listCase {
- conv, err = New(tc.dir)
- if err != nil {
- t.Fatal(err)
- }
- got, err = conv.scanDir([]string{tc.dir})
- if err != nil {
- t.Fatal(err)
- }
- test.Assert(t, tc.dir, tc.exp, got)
+ t.Run(tc.dir, func(tt *testing.T) {
+ tt.Chdir(tc.dir)
+ conv, err = New(`.`)
+ if err != nil {
+ tt.Fatal(err)
+ }
+ got, err = conv.scanDir([]string{`.`})
+ if err != nil {
+ tt.Fatal(err)
+ }
+ test.Assert(tt, tc.dir, tc.exp, got)
+ })
}
}