@@ -417,13 +417,14 @@ stringer [flags] -type T files...`,
417417 }
418418}
419419
420- func setup (t * testing.T ) string {
420+ func setup (t * testing.T , args ... string ) string {
421421 t .Helper ()
422422 prevArgs := os .Args
423423 t .Cleanup (func () { os .Args = prevArgs })
424424 tmp := t .TempDir ()
425425 out := filepath .Join (tmp , "out" )
426- os .Args = []string {"gohelp2man" , "-output" , out , "testdata/test.sh" }
426+ os .Args = append ([]string {"gohelp2man" }, args ... )
427+ os .Args = append (os .Args , "-output" , out , "testdata/test.sh" )
427428 return out
428429}
429430
@@ -437,9 +438,12 @@ func TestFull(t *testing.T) {
437438 for _ , c := range cases {
438439 t .Run (c , func (t * testing.T ) {
439440 basename := filepath .Join ("testdata" , "test_full_" + c )
440- out := setup (t )
441- last := len (os .Args ) - 1
442- os .Args = append (os .Args [:last ], "-opt-include" , basename + ".h2m" , os .Args [last ])
441+ args := []string {"-opt-include" , basename + ".h2m" }
442+ if strargs , err := os .ReadFile (basename + ".args" ); err == nil {
443+ f := func (r rune ) bool { return r == '\n' || r == '\r' }
444+ args = append (args , strings .FieldsFunc (string (strargs ), f )... )
445+ }
446+ out := setup (t , args ... )
443447 t .Setenv ("GOHELP2MAN_TESTCASE" , basename + ".txt" )
444448 t .Setenv ("SOURCE_DATE_EPOCH" , "0" )
445449 main ()
0 commit comments