github.com/jdhenke/godel@v0.0.0-20161213181855-abeb3861bf0d/apps/gunit/generated_src/amalgomatedtesters.go (about)

     1  // generated by amalgomate; DO NOT EDIT
     2  package amalgomatedtesters
     3  
     4  import (
     5  	"fmt"
     6  	"sort"
     7  
     8  	gojunitreport "github.com/palantir/godel/apps/gunit/generated_src/internal/github.com/jstemmer/go-junit-report"
     9  	gotest "github.com/palantir/godel/apps/gunit/generated_src/internal/github.com/nmiyake/gotest"
    10  	gt "github.com/palantir/godel/apps/gunit/generated_src/internal/rsc.io/gt"
    11  )
    12  
    13  var programs = map[string]func(){"gojunitreport": func() {
    14  	gojunitreport.AmalgomatedMain()
    15  }, "gotest": func() {
    16  	gotest.AmalgomatedMain()
    17  }, "gt": func() {
    18  	gt.AmalgomatedMain()
    19  },
    20  }
    21  
    22  func Instance() Amalgomated {
    23  	return &amalgomated{}
    24  }
    25  
    26  type Amalgomated interface {
    27  	Run(cmd string)
    28  	Cmds() []string
    29  }
    30  
    31  type amalgomated struct{}
    32  
    33  func (a *amalgomated) Run(cmd string) {
    34  	if _, ok := programs[cmd]; !ok {
    35  		panic(fmt.Sprintf("Unknown command: \"%v\". Valid values: %v", cmd, a.Cmds()))
    36  	}
    37  	programs[cmd]()
    38  }
    39  
    40  func (a *amalgomated) Cmds() []string {
    41  	var cmds []string
    42  	for key := range programs {
    43  		cmds = append(cmds, key)
    44  	}
    45  	sort.Strings(cmds)
    46  	return cmds
    47  }