@@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"bufio"
5
5
"bytes"
6
+ "encoding/json"
6
7
"io/ioutil"
7
8
"os"
8
9
"path/filepath"
@@ -45,6 +46,10 @@ func TestExamples(t *testing.T) {
45
46
}
46
47
}
47
48
49
+ type testConfig struct {
50
+ ExperimentalParserOnly bool `json:"experimental_parser_only"`
51
+ }
52
+
48
53
func TestReplay (t * testing.T ) {
49
54
t .Parallel ()
50
55
files , err := ioutil .ReadDir ("testdata" )
@@ -73,6 +78,21 @@ func TestReplay(t *testing.T) {
73
78
t .Run (tc + "/deprecated-parser" , func (t * testing.T ) {
74
79
t .Parallel ()
75
80
path , _ := filepath .Abs (filepath .Join ("testdata" , tc ))
81
+ // TODO: Extract test configuration into a method
82
+ confPath := filepath .Join (path , "endtoend.json" )
83
+ if _ , err := os .Stat (confPath ); ! os .IsNotExist (err ) {
84
+ blob , err := ioutil .ReadFile (confPath )
85
+ if err != nil {
86
+ t .Fatal (err )
87
+ }
88
+ var conf testConfig
89
+ if err := json .Unmarshal (blob , & conf ); err != nil {
90
+ t .Fatal (err )
91
+ }
92
+ if conf .ExperimentalParserOnly {
93
+ t .Skip ("experimental parser only" )
94
+ }
95
+ }
76
96
var stderr bytes.Buffer
77
97
expected := expectedStderr (t , path )
78
98
output , err := cmd .Generate (cmd.Env {ExperimentalParser : false }, path , & stderr )
0 commit comments