@@ -15,13 +15,15 @@ import (
15
15
)
16
16
17
17
type testFlags struct {
18
- from string // default: 'index.scip'
19
- commentSyntax string // default: '//'
20
- pathFilters cli.StringSlice
18
+ from string // default: 'index.scip'
19
+ commentSyntax string // default: '//'
20
+ pathFilters cli.StringSlice
21
+ checkDocuments bool // default: false
21
22
}
22
23
23
24
func testCommand () cli.Command {
24
25
var testFlags testFlags
26
+
25
27
test := cli.Command {
26
28
Name : "test" ,
27
29
Usage : "Validate a SCIP index against test files" ,
@@ -46,6 +48,12 @@ use the 'snapshot' subcommand.`, version),
46
48
Usage : "Explicit list of test files to check. Can be specified multiple times. If not specified, all files are tested." ,
47
49
Destination : & testFlags .pathFilters ,
48
50
},
51
+ & cli.BoolFlag {
52
+ Name : "check-documents" ,
53
+ Usage : "Whether or not to validate whether every file in the test directory has a correlating document in the SCIP index." ,
54
+ Destination : & testFlags .checkDocuments ,
55
+ Value : false ,
56
+ },
49
57
},
50
58
Action : func (c * cli.Context ) error {
51
59
dir := c .Args ().Get (0 )
@@ -55,7 +63,7 @@ use the 'snapshot' subcommand.`, version),
55
63
return err
56
64
}
57
65
58
- return testMain (dir , testFlags .pathFilters .Value (), index , testFlags .commentSyntax , os .Stdout )
66
+ return testMain (dir , testFlags .pathFilters .Value (), testFlags . checkDocuments , index , testFlags .commentSyntax , os .Stdout )
59
67
},
60
68
}
61
69
return test
@@ -64,6 +72,7 @@ use the 'snapshot' subcommand.`, version),
64
72
func testMain (
65
73
directory string ,
66
74
fileFilters []string ,
75
+ checkDocuments bool ,
67
76
index * scip.Index ,
68
77
commentSyntax string ,
69
78
output io.Writer ,
@@ -150,7 +159,7 @@ func testMain(
150
159
}
151
160
}
152
161
153
- if len (allTestFilesSet ) > 0 {
162
+ if checkDocuments && len (allTestFilesSet ) > 0 {
154
163
sortedFiles := []string {}
155
164
for f , _ := range allTestFilesSet {
156
165
sortedFiles = append (sortedFiles , f )
0 commit comments