Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
proper float formating
Browse files Browse the repository at this point in the history
  • Loading branch information
nustiueudinastea committed Jan 20, 2017
1 parent 8ed9b16 commit 240ba89
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion service.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *service) Authorise(amount float32) (Authorisation, error) {
authorised = true
message = "Payment authorised"
} else {
message = fmt.Sprintf("Payment declined: amount exceeds $%d", s.declineOverAmount)
message = fmt.Sprintf("Payment declined: amount exceeds %.2f", s.declineOverAmount)
}
return Authorisation{
Authorised: authorised,
Expand Down
2 changes: 1 addition & 1 deletion service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestAuthorise(t *testing.T) {
func TestFailOverCertainAmount(t *testing.T) {
declineAmount := float32(10)
result, _ := NewAuthorisationService(declineAmount).Authorise(100)
expected := Authorisation{false, fmt.Sprintf("Payment declined: amount exceeds $%d", declineAmount)}
expected := Authorisation{false, fmt.Sprintf("Payment declined: amount exceeds %.2f", declineAmount)}
if result != expected {
t.Errorf("Authorise returned unexpected result: got %v want %v",
result, expected)
Expand Down

0 comments on commit 240ba89

Please sign in to comment.