@@ -3,6 +3,7 @@ package main
33import (
44 "bufio"
55 "bytes"
6+ "encoding/json"
67 "io/ioutil"
78 "os"
89 "path/filepath"
@@ -45,6 +46,10 @@ func TestExamples(t *testing.T) {
4546 }
4647}
4748
49+ type testConfig struct {
50+ ExperimentalParserOnly bool `json:"experimental_parser_only"`
51+ }
52+
4853func TestReplay (t * testing.T ) {
4954 t .Parallel ()
5055 files , err := ioutil .ReadDir ("testdata" )
@@ -73,6 +78,21 @@ func TestReplay(t *testing.T) {
7378 t .Run (tc + "/deprecated-parser" , func (t * testing.T ) {
7479 t .Parallel ()
7580 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+ }
7696 var stderr bytes.Buffer
7797 expected := expectedStderr (t , path )
7898 output , err := cmd .Generate (cmd.Env {ExperimentalParser : false }, path , & stderr )
0 commit comments