Skip to content

Commit

Permalink
Merge pull request #362 from dvrkps/i284
Browse files Browse the repository at this point in the history
bracket-push: Improve error-handling behavior (close #284)
  • Loading branch information
petertseng authored Oct 1, 2016
2 parents 3e6b2ad + 00c3f5e commit 10b833f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions exercises/bracket-push/bracket_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
)

const targetTestVersion = 3
const targetTestVersion = 4

var testCases = []struct {
input string
Expand Down Expand Up @@ -49,20 +49,21 @@ var testCases = []struct {
}

func TestBracket(t *testing.T) {
if testVersion != targetTestVersion {
t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
}
for _, tt := range testCases {
actual, err := Bracket(tt.input)
// We don't expect errors for any of the test cases
if err != nil {
var _ error = err
t.Fatalf("Bracket(%q) returned error %q. Error not expected.", tt.input, err)
}
if actual != tt.expected {
t.Fatalf("Bracket(%q) was expected to return %v but returned %v.",
tt.input, tt.expected, actual)
}
}
if testVersion != targetTestVersion {
t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
}
}

func BenchmarkBracket(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion exercises/bracket-push/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

// testVersion shows the version of the exercise.
const testVersion = 3
const testVersion = 4

type bracketKind int

Expand Down

0 comments on commit 10b833f

Please sign in to comment.