renamed RegisterFormatter to Format

Этот коммит содержится в:
gedi 2015-07-03 16:01:46 +03:00
родитель 970eddc16a
коммит 882480ccd0
4 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -150,6 +150,7 @@ obvious reason to keep an interface.
- in order to support running suite concurrently, needed to refactor an entry point of application. The **Run** method - in order to support running suite concurrently, needed to refactor an entry point of application. The **Run** method
now is a func of godog package which initializes and run the suite (or more suites). Method **New** is removed. This now is a func of godog package which initializes and run the suite (or more suites). Method **New** is removed. This
change made godog a little cleaner. change made godog a little cleaner.
- renamed **RegisterFormatter** func to **Format** to be more consistent.
### FAQ ### FAQ

6
fmt.go
Просмотреть файл

@ -65,10 +65,10 @@ func findFmt(format string) (f Formatter, err error) {
return return
} }
// RegisterFormatter registers a feature suite output // Format registers a feature suite output
// Formatter as the name and descriptiongiven. // Formatter as the name and descriptiongiven.
// Formatter is used to represent suite output // Formatter is used to represent suite output
func RegisterFormatter(name, description string, f Formatter) { func Format(name, description string, f Formatter) {
formatters = append(formatters, &registeredFormatter{ formatters = append(formatters, &registeredFormatter{
name: name, name: name,
fmt: f, fmt: f,
@ -82,7 +82,7 @@ func RegisterFormatter(name, description string, f Formatter) {
// New formatters may be created to represent // New formatters may be created to represent
// suite results in different ways. These new // suite results in different ways. These new
// formatters needs to be registered with a // formatters needs to be registered with a
// RegisterFormatter function call // godog.Format function call
type Formatter interface { type Formatter interface {
Feature(*gherkin.Feature, string) Feature(*gherkin.Feature, string)
Node(interface{}) Node(interface{})

Просмотреть файл

@ -11,7 +11,7 @@ import (
) )
func init() { func init() {
RegisterFormatter("pretty", "Prints every feature with runtime statuses.", &pretty{ Format("pretty", "Prints every feature with runtime statuses.", &pretty{
basefmt: basefmt{ basefmt: basefmt{
started: time.Now(), started: time.Now(),
indent: 2, indent: 2,

Просмотреть файл

@ -10,7 +10,7 @@ import (
) )
func init() { func init() {
RegisterFormatter("progress", "Prints a character per step.", &progress{ Format("progress", "Prints a character per step.", &progress{
basefmt: basefmt{ basefmt: basefmt{
started: time.Now(), started: time.Now(),
indent: 2, indent: 2,