forked from barak/tarpoon
Add glide.yaml and vendor deps
This commit is contained in:
parent
db918f12ad
commit
5b3d5e81bd
18880 changed files with 5166045 additions and 1 deletions
57
vendor/gopkg.in/cheggaaa/pb.v1/format_test.go
generated
vendored
Normal file
57
vendor/gopkg.in/cheggaaa/pb.v1/format_test.go
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package pb_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gopkg.in/cheggaaa/pb.v1"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Test_DefaultsToInteger(t *testing.T) {
|
||||
value := int64(1000)
|
||||
expected := strconv.Itoa(int(value))
|
||||
actual := pb.Format(value).String()
|
||||
|
||||
if actual != expected {
|
||||
t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_CanFormatAsInteger(t *testing.T) {
|
||||
value := int64(1000)
|
||||
expected := strconv.Itoa(int(value))
|
||||
actual := pb.Format(value).To(pb.U_NO).String()
|
||||
|
||||
if actual != expected {
|
||||
t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_CanFormatAsBytes(t *testing.T) {
|
||||
value := int64(1000)
|
||||
expected := "1000 B"
|
||||
actual := pb.Format(value).To(pb.U_BYTES).String()
|
||||
|
||||
if actual != expected {
|
||||
t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_CanFormatDuration(t *testing.T) {
|
||||
value := 10 * time.Minute
|
||||
expected := "10m0s"
|
||||
actual := pb.Format(int64(value)).To(pb.U_DURATION).String()
|
||||
if actual != expected {
|
||||
t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_DefaultUnitsWidth(t *testing.T) {
|
||||
value := 10
|
||||
expected := " 10"
|
||||
actual := pb.Format(int64(value)).Width(7).String()
|
||||
if actual != expected {
|
||||
t.Error(fmt.Sprintf("Expected {%s} was {%s}", expected, actual))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue