Этот коммит содержится в:
hgouchet 2018-09-29 13:12:16 +02:00
родитель b03bcc9c55
коммит 2604810f50
7 изменённых файлов: 27 добавлений и 28 удалений

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

@ -16,8 +16,8 @@ const (
red
green
yellow
blue
magenta
blue // unused
magenta // unused
cyan
white
)

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

@ -16,7 +16,7 @@ type outputMode int
const (
_ outputMode = iota
discardNonColorEscSeq
outputNonColorEscSeq
outputNonColorEscSeq // unused
)
// Colored creates and initializes a new ansiColorWriter

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

@ -148,11 +148,13 @@ func (j *junitFormatter) Summary() {
j.current().Time = timeNowFunc().Sub(j.featStarted).String()
}
j.suite.Time = timeNowFunc().Sub(j.started).String()
io.WriteString(j.out, xml.Header)
_, err := io.WriteString(j.out, xml.Header)
if err != nil {
fmt.Fprintln(os.Stderr, "failed to write junit string:", err)
}
enc := xml.NewEncoder(j.out)
enc.Indent("", s(2))
if err := enc.Encode(j.suite); err != nil {
if err = enc.Encode(j.suite); err != nil {
fmt.Fprintln(os.Stderr, "failed to write junit xml:", err)
}
}

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

@ -152,19 +152,18 @@ func TestJUnitFormatterOutput(t *testing.T) {
},
}},
}
s.run()
s.fmt.Summary()
var exp bytes.Buffer
io.WriteString(&exp, xml.Header)
enc := xml.NewEncoder(&exp)
enc.Indent("", " ")
if err := enc.Encode(expected); err != nil {
if _, err = io.WriteString(&exp, xml.Header); err != nil {
t.Fatalf("unexpected error: %v", err)
}
enc := xml.NewEncoder(&exp)
enc.Indent("", " ")
if err = enc.Encode(expected); err != nil {
t.Fatalf("unexpected error: %v", err)
}
if buf.String() != exp.String() {
t.Fatalf("expected output does not match: %s", buf.String())
}

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

@ -178,8 +178,8 @@ func TestFailsWithUnknownFormatterOptionError(t *testing.T) {
}
out := strings.TrimSpace(string(b))
if strings.Index(out, `unregistered formatter name: "unknown", use one of`) == -1 {
t.Fatalf("unexpected error output: \"%s\"", out)
if !strings.Contains(out, `unregistered formatter name: "unknown", use one of`) {
t.Fatalf("unexpected error output: %q", out)
}
}

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

@ -805,7 +805,7 @@ func matchesTags(filter string, tags []string) (ok bool) {
okComma = hasTag(tags, tag) || okComma
}
}
ok = (false != okComma && ok && okComma) || false
ok = ok && okComma
}
return
}

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

@ -7,18 +7,16 @@ import (
"github.com/DATA-DOG/godog/colors"
)
// empty struct value takes no space allocation
type void struct{}
var red = colors.Red
var redb = colors.Bold(colors.Red)
var green = colors.Green
var black = colors.Black
var blackb = colors.Bold(colors.Black)
var yellow = colors.Yellow
var cyan = colors.Cyan
var cyanb = colors.Bold(colors.Cyan)
var whiteb = colors.Bold(colors.White)
var (
red = colors.Red
redb = colors.Bold(colors.Red)
green = colors.Green
black = colors.Black
yellow = colors.Yellow
cyan = colors.Cyan
cyanb = colors.Bold(colors.Cyan)
whiteb = colors.Bold(colors.White)
)
// repeats a space n times
func s(n int) string {