Skip to content

Commit

Permalink
Change status to basic ASCII
Browse files Browse the repository at this point in the history
fixes #358
  • Loading branch information
b-chu authored Oct 19, 2023
1 parent 3e8f3e1 commit e1eb414
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion cmd/spr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GLOBAL OPTIONS:
COMMANDS:
{{range .Commands}}{{if not .HideHelp}} {{join .Names ","}}{{ "\t"}}{{.Usage}}{{ "\n" }}{{end}}{{end}}
AUTHOR: {{range .Authors}}{{ . }}{{end}}
VERSION: {{.Version}}
VERSION: fork of {{.Version}}
`

app := &cli.App{
Expand Down
6 changes: 3 additions & 3 deletions github/pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ const (
colorBlue = "\033[34m"

// ascii status bits
asciiCheckmark = ""
asciiCrossmark = ""
asciiPending = "·"
asciiCheckmark = "v"
asciiCrossmark = "x"
asciiPending = "."
asciiQuerymark = "?"
asciiEmpty = "-"
asciiWarning = "!"
Expand Down
24 changes: 12 additions & 12 deletions github/pullrequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ func TestStatusString(t *testing.T) {
}

tests := []testcase{
{pr(CheckStatusPass, true, true, true), cfg(true, true), "[✔✔✔✔]"},
{pr(CheckStatusFail, true, true, true), cfg(true, true), "[✗✔✔✔]"},
{pr(CheckStatusUnknown, true, true, true), cfg(true, true), "[?✔✔✔]"},
{pr(CheckStatusPending, true, true, true), cfg(true, true), "[·✔✔✔]"},
{pr(CheckStatusPass, false, true, true), cfg(true, true), "[✔✗✔✔]"},
{pr(CheckStatusPass, true, false, true), cfg(true, true), "[✔✔✗✔]"},
{pr(CheckStatusPass, true, true, false), cfg(true, true), "[✔✔✔✗]"},
{pr(CheckStatusPass, true, true, true), cfg(false, true), "[-✔✔✔]"},
{pr(CheckStatusPass, true, true, true), cfg(false, false), "[--✔✔]"},
{pr(CheckStatusPass, true, true, true), cfg(true, true), "[vvvv]"},
{pr(CheckStatusFail, true, true, true), cfg(true, true), "[xvvv]"},
{pr(CheckStatusUnknown, true, true, true), cfg(true, true), "[?vvv]"},
{pr(CheckStatusPending, true, true, true), cfg(true, true), "[.vvv]"},
{pr(CheckStatusPass, false, true, true), cfg(true, true), "[vxvv]"},
{pr(CheckStatusPass, true, false, true), cfg(true, true), "[vvxv]"},
{pr(CheckStatusPass, true, true, false), cfg(true, true), "[vvvx]"},
{pr(CheckStatusPass, true, true, true), cfg(false, true), "[-vvv]"},
{pr(CheckStatusPass, true, true, true), cfg(false, false), "[--vv]"},
}
for i, test := range tests {
assert.Equal(t, test.expect, test.pr.StatusString(test.cfg), fmt.Sprintf("case %d failed", i))
Expand Down Expand Up @@ -171,9 +171,9 @@ func TestString(t *testing.T) {
}

tests := []testcase{
{expect: "[?✗✗✗] · 0 : Title", pr: pr(true, 1), cfg: cfg},
{expect: "[?✗✗✗] · 0 : Title", pr: pr(true, 2), cfg: cfg},
{expect: "[?✗✗✗] ! 0 : Title", pr: pr(false, 2), cfg: cfg},
{expect: "[?xxx] . 0 : Title", pr: pr(true, 1), cfg: cfg},
{expect: "[?xxx] . 0 : Title", pr: pr(true, 2), cfg: cfg},
{expect: "[?xxx] ! 0 : Title", pr: pr(false, 2), cfg: cfg},
}
for i, test := range tests {
assert.Equal(t, test.expect, test.pr.String(test.cfg), fmt.Sprintf("case %d failed", i))
Expand Down
98 changes: 49 additions & 49 deletions spr/spr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestSPRBasicFlowFourCommitsQueue(t *testing.T) {
githubmock.ExpectGetInfo()
s.UpdatePullRequests(ctx, []string{mockclient.NobodyLogin}, nil)
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("[✔✔✔✔] 1 : test commit 1\n", output.String())
assert.Equal("[vvvv] 1 : test commit 1\n", output.String())
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c1, c2]
Expand All @@ -102,8 +102,8 @@ func TestSPRBasicFlowFourCommitsQueue(t *testing.T) {
lines := strings.Split(output.String(), "\n")
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("warning: not updating reviewers for PR #1", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[1])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[2])
assert.Equal("[vvvv] 1 : test commit 2", lines[1])
assert.Equal("[vvvv] 1 : test commit 1", lines[2])
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c1, c2, c3, c4]
Expand Down Expand Up @@ -132,10 +132,10 @@ func TestSPRBasicFlowFourCommitsQueue(t *testing.T) {
assert.Equal([]string{
"warning: not updating reviewers for PR #1",
"warning: not updating reviewers for PR #1",
"[✔✔✔✔] 1 : test commit 4",
"[✔✔✔✔] 1 : test commit 3",
"[✔✔✔✔] 1 : test commit 2",
"[✔✔✔✔] 1 : test commit 1",
"[vvvv] 1 : test commit 4",
"[vvvv] 1 : test commit 3",
"[vvvv] 1 : test commit 2",
"[vvvv] 1 : test commit 1",
}, lines[:6])
output.Reset()

Expand Down Expand Up @@ -170,9 +170,9 @@ func TestSPRBasicFlowFourCommitsQueue(t *testing.T) {
"warning: not updating reviewers for PR #1",
"warning: not updating reviewers for PR #1",
"warning: not updating reviewers for PR #1",
"[✔✔✔✔] 1 : test commit 4",
"[✔✔✔✔] 1 : test commit 3",
"[✔✔✔✔] ! 1 : test commit 2",
"[vvvv] 1 : test commit 4",
"[vvvv] 1 : test commit 3",
"[vvvv] ! 1 : test commit 2",
}, lines[:6])
output.Reset()

Expand All @@ -192,7 +192,7 @@ func TestSPRBasicFlowFourCommitsQueue(t *testing.T) {

s.MergePullRequests(ctx, nil)
lines = strings.Split(output.String(), "\n")
assert.Equal("MERGED · 1 : test commit 2", lines[0])
assert.Equal("MERGED . 1 : test commit 2", lines[0])
assert.Equal("MERGED 1 : test commit 3", lines[1])
assert.Equal("MERGED 1 : test commit 4", lines[2])
fmt.Printf("OUT: %s\n", output.String())
Expand Down Expand Up @@ -243,7 +243,7 @@ func TestSPRBasicFlowFourCommits(t *testing.T) {
githubmock.ExpectGetInfo()
s.UpdatePullRequests(ctx, []string{mockclient.NobodyLogin}, nil)
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("[✔✔✔✔] 1 : test commit 1\n", output.String())
assert.Equal("[vvvv] 1 : test commit 1\n", output.String())
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c1, c2]
Expand All @@ -261,8 +261,8 @@ func TestSPRBasicFlowFourCommits(t *testing.T) {
lines := strings.Split(output.String(), "\n")
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("warning: not updating reviewers for PR #1", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[1])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[2])
assert.Equal("[vvvv] 1 : test commit 2", lines[1])
assert.Equal("[vvvv] 1 : test commit 1", lines[2])
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c1, c2, c3, c4]
Expand Down Expand Up @@ -291,10 +291,10 @@ func TestSPRBasicFlowFourCommits(t *testing.T) {
assert.Equal([]string{
"warning: not updating reviewers for PR #1",
"warning: not updating reviewers for PR #1",
"[✔✔✔✔] 1 : test commit 4",
"[✔✔✔✔] 1 : test commit 3",
"[✔✔✔✔] 1 : test commit 2",
"[✔✔✔✔] 1 : test commit 1",
"[vvvv] 1 : test commit 4",
"[vvvv] 1 : test commit 3",
"[vvvv] 1 : test commit 2",
"[vvvv] 1 : test commit 1",
}, lines[:6])
output.Reset()

Expand Down Expand Up @@ -370,10 +370,10 @@ func TestSPRMergeCount(t *testing.T) {
lines := strings.Split(output.String(), "\n")
fmt.Printf("OUT: %s\n", output.String())
assert.Equal([]string{
"[✔✔✔✔] 1 : test commit 4",
"[✔✔✔✔] 1 : test commit 3",
"[✔✔✔✔] 1 : test commit 2",
"[✔✔✔✔] 1 : test commit 1",
"[vvvv] 1 : test commit 4",
"[vvvv] 1 : test commit 3",
"[vvvv] 1 : test commit 2",
"[vvvv] 1 : test commit 1",
}, lines[:4])
output.Reset()

Expand Down Expand Up @@ -426,8 +426,8 @@ func TestSPRAmendCommit(t *testing.T) {
s.UpdatePullRequests(ctx, nil, nil)
fmt.Printf("OUT: %s\n", output.String())
lines := strings.Split(output.String(), "\n")
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[1])
assert.Equal("[vvvv] 1 : test commit 2", lines[0])
assert.Equal("[vvvv] 1 : test commit 1", lines[1])
output.Reset()

// amend commit c2
Expand All @@ -443,8 +443,8 @@ func TestSPRAmendCommit(t *testing.T) {
s.UpdatePullRequests(ctx, nil, nil)
lines = strings.Split(output.String(), "\n")
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[1])
assert.Equal("[vvvv] 1 : test commit 2", lines[0])
assert.Equal("[vvvv] 1 : test commit 1", lines[1])
output.Reset()

// amend commit c1
Expand All @@ -461,8 +461,8 @@ func TestSPRAmendCommit(t *testing.T) {
s.UpdatePullRequests(ctx, nil, nil)
lines = strings.Split(output.String(), "\n")
fmt.Printf("OUT: %s\n", output.String())
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[1])
assert.Equal("[vvvv] 1 : test commit 2", lines[0])
assert.Equal("[vvvv] 1 : test commit 1", lines[1])
output.Reset()

// 'git spr merge' :: MergePullRequest :: commits=[a1, a2]
Expand Down Expand Up @@ -535,10 +535,10 @@ func TestSPRReorderCommit(t *testing.T) {
s.UpdatePullRequests(ctx, nil, nil)
fmt.Printf("OUT: %s\n", output.String())
lines := strings.Split(output.String(), "\n")
assert.Equal("[✔✔✔✔] 1 : test commit 4", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 3", lines[1])
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[2])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[3])
assert.Equal("[vvvv] 1 : test commit 4", lines[0])
assert.Equal("[vvvv] 1 : test commit 3", lines[1])
assert.Equal("[vvvv] 1 : test commit 2", lines[2])
assert.Equal("[vvvv] 1 : test commit 1", lines[3])
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c2, c4, c1, c3]
Expand All @@ -564,10 +564,10 @@ func TestSPRReorderCommit(t *testing.T) {
fmt.Printf("OUT: %s\n", output.String())
// TODO : Need to update pull requests in GetInfo expect to get this check to work
// lines = strings.Split(output.String(), "\n")
//assert.Equal("[✔✔✔✔] 1 : test commit 3", lines[0])
//assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[1])
//assert.Equal("[✔✔✔✔] 1 : test commit 4", lines[2])
//assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[3])
//assert.Equal("[vvvv] 1 : test commit 3", lines[0])
//assert.Equal("[vvvv] 1 : test commit 1", lines[1])
//assert.Equal("[vvvv] 1 : test commit 4", lines[2])
//assert.Equal("[vvvv] 1 : test commit 2", lines[3])
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c5, c1, c2, c3, c4]
Expand Down Expand Up @@ -595,11 +595,11 @@ func TestSPRReorderCommit(t *testing.T) {
fmt.Printf("OUT: %s\n", output.String())
// TODO : Need to update pull requests in GetInfo expect to get this check to work
// lines = strings.Split(output.String(), "\n")
//assert.Equal("[✔✔✔✔] 1 : test commit 5", lines[0])
//assert.Equal("[✔✔✔✔] 1 : test commit 4", lines[1])
//assert.Equal("[✔✔✔✔] 1 : test commit 3", lines[2])
//assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[3])
//assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[4])
//assert.Equal("[vvvv] 1 : test commit 5", lines[0])
//assert.Equal("[vvvv] 1 : test commit 4", lines[1])
//assert.Equal("[vvvv] 1 : test commit 3", lines[2])
//assert.Equal("[vvvv] 1 : test commit 2", lines[3])
//assert.Equal("[vvvv] 1 : test commit 1", lines[4])
output.Reset()

// TODO : add a call to merge and check merge order
Expand Down Expand Up @@ -655,10 +655,10 @@ func TestSPRDeleteCommit(t *testing.T) {
s.UpdatePullRequests(ctx, nil, nil)
fmt.Printf("OUT: %s\n", output.String())
lines := strings.Split(output.String(), "\n")
assert.Equal("[✔✔✔✔] 1 : test commit 4", lines[0])
assert.Equal("[✔✔✔✔] 1 : test commit 3", lines[1])
assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[2])
assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[3])
assert.Equal("[vvvv] 1 : test commit 4", lines[0])
assert.Equal("[vvvv] 1 : test commit 3", lines[1])
assert.Equal("[vvvv] 1 : test commit 2", lines[2])
assert.Equal("[vvvv] 1 : test commit 1", lines[3])
output.Reset()

// 'git spr update' :: UpdatePullRequest :: commits=[c2, c4, c1, c3]
Expand All @@ -680,10 +680,10 @@ func TestSPRDeleteCommit(t *testing.T) {
fmt.Printf("OUT: %s\n", output.String())
// TODO : Need to update pull requests in GetInfo expect to get this check to work
// lines = strings.Split(output.String(), "\n")
//assert.Equal("[✔✔✔✔] 1 : test commit 3", lines[0])
//assert.Equal("[✔✔✔✔] 1 : test commit 1", lines[1])
//assert.Equal("[✔✔✔✔] 1 : test commit 4", lines[2])
//assert.Equal("[✔✔✔✔] 1 : test commit 2", lines[3])
//assert.Equal("[vvvv] 1 : test commit 3", lines[0])
//assert.Equal("[vvvv] 1 : test commit 1", lines[1])
//assert.Equal("[vvvv] 1 : test commit 4", lines[2])
//assert.Equal("[vvvv] 1 : test commit 2", lines[3])
output.Reset()

// TODO : add a call to merge and check merge order
Expand Down

0 comments on commit e1eb414

Please sign in to comment.