diff --git a/draw_test.go b/draw_test.go index bd289fb..01da364 100644 --- a/draw_test.go +++ b/draw_test.go @@ -13,7 +13,7 @@ style string total, current int64 barWidth int - trimSpace bool + trim bool reverse bool refill int64 want string @@ -26,11 +26,11 @@ want: "… ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "", }, }, 1: { @@ -41,11 +41,11 @@ want: "… ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "", }, }, 2: { @@ -56,11 +56,11 @@ want: " ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[]", }, }, 3: { @@ -71,11 +71,11 @@ want: " ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[-]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[-]", }, }, 4: { @@ -86,11 +86,11 @@ want: " [] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[>-]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[>-]", }, }, 5: { @@ -101,11 +101,11 @@ want: " [-] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[>--]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[>--]", }, }, 6: { @@ -116,11 +116,11 @@ want: " [>-] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[>---]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[>---]", }, }, 7: { @@ -131,11 +131,11 @@ want: " [>--] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[=>---]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[=>---]", }, }, 8: { @@ -146,11 +146,11 @@ want: " [>---] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[=>----]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[=>----]", }, }, 80: { @@ -161,11 +161,11 @@ want: " [========================>---------------------------------------------------] ", }, { - name: "t,c{60,20}trim", - total: 60, - current: 20, - trimSpace: true, - want: "[=========================>----------------------------------------------------]", + name: "t,c{60,20}trim", + total: 60, + current: 20, + trim: true, + want: "[=========================>----------------------------------------------------]", }, { name: "t,c,bw{60,20,60}", @@ -175,12 +175,12 @@ want: " [==================>---------------------------------------] ", }, { - name: "t,c,bw{60,20,60}trim", - total: 60, - current: 20, - barWidth: 60, - trimSpace: true, - want: "[==================>---------------------------------------]", + name: "t,c,bw{60,20,60}trim", + total: 60, + current: 20, + barWidth: 60, + trim: true, + want: "[==================>---------------------------------------]", }, }, 100: { @@ -191,11 +191,11 @@ want: " [------------------------------------------------------------------------------------------------] ", }, { - name: "t,c{100,0}trim", - total: 100, - current: 0, - trimSpace: true, - want: "[--------------------------------------------------------------------------------------------------]", + name: "t,c{100,0}trim", + total: 100, + current: 0, + trim: true, + want: "[--------------------------------------------------------------------------------------------------]", }, { name: "t,c{100,1}", @@ -204,11 +204,11 @@ want: " [>-----------------------------------------------------------------------------------------------] ", }, { - name: "t,c{100,1}trim", - total: 100, - current: 1, - trimSpace: true, - want: "[>-------------------------------------------------------------------------------------------------]", + name: "t,c{100,1}trim", + total: 100, + current: 1, + trim: true, + want: "[>-------------------------------------------------------------------------------------------------]", }, { name: "t,c{100,33}", @@ -217,58 +217,58 @@ want: " [===============================>----------------------------------------------------------------] ", }, { - name: "t,c{100,33}trim", - total: 100, - current: 33, - trimSpace: true, - want: "[===============================>------------------------------------------------------------------]", - }, - { - name: "t,c{100,33}trim,rev", - total: 100, - current: 33, - trimSpace: true, - reverse: true, - want: "[------------------------------------------------------------------<===============================]", - }, - { - name: "t,c,refill{100,33,33}", + name: "t,c{100,33}trim", + total: 100, + current: 33, + trim: true, + want: "[===============================>------------------------------------------------------------------]", + }, + { + name: "t,c{100,33}trim,rev", + total: 100, + current: 33, + trim: true, + reverse: true, + want: "[------------------------------------------------------------------<===============================]", + }, + { + name: "t,c,r{100,33,33}", total: 100, current: 33, refill: 33, want: " [+++++++++++++++++++++++++++++++>----------------------------------------------------------------] ", }, { - name: "t,c,refill{100,33,33}trim", - total: 100, - current: 33, - refill: 33, - trimSpace: true, - want: "[+++++++++++++++++++++++++++++++>------------------------------------------------------------------]", - }, - { - name: "t,c,refill{100,33,33}trim,rev", - total: 100, - current: 33, - refill: 33, - trimSpace: true, - reverse: true, - want: "[------------------------------------------------------------------<+++++++++++++++++++++++++++++++]", - }, - { - name: "t,c,refill{100,40,33}", + name: "t,c,r{100,33,33}trim", + total: 100, + current: 33, + refill: 33, + trim: true, + want: "[+++++++++++++++++++++++++++++++>------------------------------------------------------------------]", + }, + { + name: "t,c,r{100,33,33}trim,rev", + total: 100, + current: 33, + refill: 33, + trim: true, + reverse: true, + want: "[------------------------------------------------------------------<+++++++++++++++++++++++++++++++]", + }, + { + name: "t,c,r{100,40,33}", total: 100, current: 40, refill: 33, want: " [++++++++++++++++++++++++++++++++=====>----------------------------------------------------------] ", }, { - name: "t,c,refill{100,40,33}trim", - total: 100, - current: 40, - refill: 33, - trimSpace: true, - want: "[++++++++++++++++++++++++++++++++======>-----------------------------------------------------------]", + name: "t,c,r{100,40,33}trim", + total: 100, + current: 40, + refill: 33, + trim: true, + want: "[++++++++++++++++++++++++++++++++======>-----------------------------------------------------------]", }, { name: "t,c{100,99}", @@ -277,11 +277,11 @@ want: " [==============================================================================================>-] ", }, { - name: "t,c{100,99}trim", - total: 100, - current: 99, - trimSpace: true, - want: "[================================================================================================>-]", + name: "t,c{100,99}trim", + total: 100, + current: 99, + trim: true, + want: "[================================================================================================>-]", }, { name: "t,c{100,100}", @@ -290,11 +290,11 @@ want: " [================================================================================================] ", }, { - name: "t,c{100,100}trim", - total: 100, - current: 100, - trimSpace: true, - want: "[==================================================================================================]", + name: "t,c{100,100}trim", + total: 100, + current: 100, + trim: true, + want: "[==================================================================================================]", }, { name: "[=の-] t,c{100,1}", @@ -313,7 +313,7 @@ s.reqWidth = tc.barWidth s.total = tc.total s.current = tc.current - s.trimSpace = tc.trimSpace + s.trimSpace = tc.trim if tc.refill > 0 { if f, ok := s.filler.(interface{ SetRefill(int64) }); ok { f.SetRefill(tc.refill)