-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code cleanup; update comments and TODOs
- Loading branch information
Showing
5 changed files
with
214 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package parse | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
|
||
"github.com/olekukonko/tablewriter" | ||
) | ||
|
||
// Packages is a collection of packages being tested. | ||
type Packages map[string]*Package | ||
|
||
func (p Packages) PrintSummary(skipNoTests bool) { | ||
tbl := tablewriter.NewWriter(os.Stdout) | ||
|
||
tbl.SetHeader([]string{ | ||
"Status", | ||
"Elapsed", | ||
"Package", | ||
"Cover", | ||
"Pass", | ||
"Fail", | ||
"Skip", | ||
}) | ||
|
||
for name, pkg := range p { | ||
|
||
if pkg.NoTest { | ||
if !skipNoTests { | ||
continue | ||
} | ||
|
||
tbl.Append([]string{ | ||
Yellow("SKIP"), | ||
"0.00s", | ||
name + "\n[no test files]", | ||
fmt.Sprintf(" %.1f%%", pkg.Coverage), | ||
"0", "0", "0", | ||
}) | ||
|
||
continue | ||
} | ||
|
||
if pkg.Cached { | ||
name += " (cached)" | ||
} | ||
|
||
tbl.Append([]string{ | ||
pkg.Summary.Action.WithColor(), | ||
strconv.FormatFloat(pkg.Summary.Elapsed, 'f', 2, 64) + "s", | ||
name, | ||
fmt.Sprintf(" %.1f%%", pkg.Coverage), | ||
strconv.Itoa(len(pkg.TestsByAction(ActionPass))), | ||
strconv.Itoa(len(pkg.TestsByAction(ActionFail))), | ||
strconv.Itoa(len(pkg.TestsByAction(ActionSkip))), | ||
}) | ||
} | ||
|
||
tbl.Render() | ||
fmt.Printf("\n") | ||
} |
Oops, something went wrong.