@@ -15,13 +15,15 @@ import (
1515)
1616
1717type 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
2122}
2223
2324func testCommand () cli.Command {
2425 var testFlags testFlags
26+
2527 test := cli.Command {
2628 Name : "test" ,
2729 Usage : "Validate a SCIP index against test files" ,
@@ -46,6 +48,12 @@ use the 'snapshot' subcommand.`, version),
4648 Usage : "Explicit list of test files to check. Can be specified multiple times. If not specified, all files are tested." ,
4749 Destination : & testFlags .pathFilters ,
4850 },
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+ },
4957 },
5058 Action : func (c * cli.Context ) error {
5159 dir := c .Args ().Get (0 )
@@ -55,7 +63,7 @@ use the 'snapshot' subcommand.`, version),
5563 return err
5664 }
5765
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 )
5967 },
6068 }
6169 return test
@@ -64,6 +72,7 @@ use the 'snapshot' subcommand.`, version),
6472func testMain (
6573 directory string ,
6674 fileFilters []string ,
75+ checkDocuments bool ,
6776 index * scip.Index ,
6877 commentSyntax string ,
6978 output io.Writer ,
@@ -150,7 +159,7 @@ func testMain(
150159 }
151160 }
152161
153- if len (allTestFilesSet ) > 0 {
162+ if checkDocuments && len (allTestFilesSet ) > 0 {
154163 sortedFiles := []string {}
155164 for f , _ := range allTestFilesSet {
156165 sortedFiles = append (sortedFiles , f )
0 commit comments