Skip to content

Commit

Permalink
housekeeping: update go.mod and fix smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgzr committed Oct 11, 2018
1 parent f4ae3f1 commit 1896c75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion go.mod
@@ -1,6 +1,8 @@
module github.com/robertgzr/porcelain

require (
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/robertgzr/color v0.0.0-20180506014805-e601f373894f
golang.org/x/sys v0.0.0-20180504064212-6f686a352de6
golang.org/x/sys v0.0.0-20180504064212-6f686a352de6 // indirect
)
8 changes: 4 additions & 4 deletions porcelain_test.go
Expand Up @@ -5,16 +5,16 @@ import (
"testing"
)

const expectedDebugOutput string = "&main.PorcInfo{branch:\"master\", commit:\"51c9c58e2175b768137c1e38865f394c76a7d49d\", remote:\"\", upstream:\"origin/master\", ahead:1, behind:10, untracked:5, unmerged:1, Unstaged:main.GitArea{modified:3, added:0, deleted:1, renamed:0, copied:0}, Staged:main.GitArea{modified:0, added:0, deleted:0, renamed:1, copied:0}}"
const expectedFmtOutput = ` [34mmaster[0m@[32;3m51c9c58[0m [2;43;30m ↑1 [0m[2;41;37m ↓10 [0m [2m?[0m[36m‼[0m[34mΔ[0m [31m✘[0m`

func TestDebugOutput(t *testing.T) {
func TestFmtOutput(t *testing.T) {
var pi = new(PorcInfo)
if err := pi.ParsePorcInfo(strings.NewReader(gitoutput)); err != nil {
t.Fatal(err)
}

if out := pi.Debug(); out != expectedDebugOutput {
t.Logf("\nexpected:\n%s\ngot:\n%s\n", expectedDebugOutput, out)
if out := pi.Fmt(); out != expectedFmtOutput {
t.Logf("\nexpected:\n%s\ngot:\n%s\n", expectedFmtOutput, out)
t.FailNow()
}
}

0 comments on commit 1896c75

Please sign in to comment.