File: parser.go

package info (click to toggle)
golang-github-smartystreets-goconvey 1.6.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 3,800 kB
  • sloc: makefile: 8
file content (32 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package parser

import (
	"log"

	"github.com/smartystreets/goconvey/web/server/contract"
)

type Parser struct {
	parser func(*contract.PackageResult, string)
}

func (self *Parser) Parse(packages []*contract.Package) {
	for _, p := range packages {
		if p.Active() && p.HasUsableResult() {
			self.parser(p.Result, p.Output)
		} else if p.Ignored {
			p.Result.Outcome = contract.Ignored
		} else if p.Disabled {
			p.Result.Outcome = contract.Disabled
		} else {
			p.Result.Outcome = contract.TestRunAbortedUnexpectedly
		}
		log.Printf("[%s]: %s\n", p.Result.Outcome, p.Name)
	}
}

func NewParser(helper func(*contract.PackageResult, string)) *Parser {
	self := new(Parser)
	self.parser = helper
	return self
}