|
@@ -4,6 +4,12 @@ import (
|
|
|
"testing"
|
|
|
)
|
|
|
|
|
|
+func pctUpdate(pct *int64) func() int64 {
|
|
|
+ return func() int64 {
|
|
|
+ return *pct
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func TestBarHalfStep(t *testing.T) {
|
|
|
|
|
|
// This is normally done by door init, but we're skipping that right now
|
|
@@ -67,8 +73,11 @@ func TestBarHalfStep(t *testing.T) {
|
|
|
100: BarColor + "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",
|
|
|
}
|
|
|
|
|
|
+ var percent int64
|
|
|
+ bar.UpdateP = pctUpdate(&percent)
|
|
|
+
|
|
|
for pct, text := range BarGrad {
|
|
|
- bar.Percent = int64(pct * 100)
|
|
|
+ percent = int64(pct * 100)
|
|
|
got := bar.Output()
|
|
|
if got != text {
|
|
|
t.Errorf("BarGradient: Expected %#v (%d%%), got %#v", text, pct, got)
|