diff --git a/fmt.go b/fmt.go index 5251bb2..fdaf0ac 100644 --- a/fmt.go +++ b/fmt.go @@ -53,9 +53,12 @@ type registeredFormatter struct { var formatters []*registeredFormatter -func findFmt(format string) FormatterFunc { +// FindFmt searches available formatters registered +// and returns FormaterFunc matched by given +// format name or nil otherwise +func FindFmt(name string) FormatterFunc { for _, el := range formatters { - if el.name == format { + if el.name == name { return el.fmt } } diff --git a/fmt_test.go b/fmt_test.go index 5051c9f..9bd4af1 100644 --- a/fmt_test.go +++ b/fmt_test.go @@ -14,7 +14,7 @@ func TestShouldFindFormatter(t *testing.T) { } for name, shouldFind := range cases { - actual := findFmt(name) + actual := FindFmt(name) if actual == nil && shouldFind { t.Fatalf("expected %s formatter should be available", name) } diff --git a/run.go b/run.go index c1c488f..22d3956 100644 --- a/run.go +++ b/run.go @@ -125,7 +125,7 @@ func RunWithOptions(suite string, contextInitializer func(suite *Suite), opt Opt fmt.Fprintln(os.Stderr, fmt.Errorf("format \"%s\" does not support concurrent execution", opt.Format)) return exitOptionError } - formatter := findFmt(opt.Format) + formatter := FindFmt(opt.Format) if nil == formatter { var names []string for name := range AvailableFormatters() { diff --git a/suite_context.go b/suite_context.go index e8528ff..d07bc99 100644 --- a/suite_context.go +++ b/suite_context.go @@ -115,7 +115,7 @@ func (s *suiteContext) ResetBeforeEachScenario(interface{}) { } func (s *suiteContext) iRunFeatureSuiteWithFormatter(name string) error { - f := findFmt(name) + f := FindFmt(name) if f == nil { return fmt.Errorf(`formatter "%s" is not available`, name) }