minor: prefer t.Error
Vladimir Bauer
1 year, 10 months ago
| 19 | 19 | bar := p.AddBar(int64(total)) |
| 20 | 20 | |
| 21 | 21 | if bar.Completed() { |
| 22 | t.Fail() | |
| 22 | t.Error("expected bar not to complete") | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | bar.IncrBy(total) |
| 26 | 26 | |
| 27 | 27 | if !bar.Completed() { |
| 28 | t.Error("bar isn't completed after increment") | |
| 28 | t.Error("expected bar to complete") | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | p.Wait() |
| 37 | 37 | bar := p.AddBar(int64(total)) |
| 38 | 38 | |
| 39 | 39 | if bar.Aborted() { |
| 40 | t.Fail() | |
| 40 | t.Error("expected bar not to be aborted") | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | bar.Abort(false) |
| 44 | 44 | |
| 45 | 45 | if !bar.Aborted() { |
| 46 | t.Error("bar isn't aborted after abort call") | |
| 46 | t.Error("expected bar to be aborted") | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | p.Wait() |
| 71 | 71 | bar := p.AddBar(0) // never complete bar |
| 72 | 72 | |
| 73 | 73 | if bar.Completed() { |
| 74 | t.Fail() | |
| 74 | t.Error("expected bar not to complete") | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Calling bar.SetTotal(0, true) has same effect |
| 79 | 79 | bar.EnableTriggerComplete() |
| 80 | 80 | |
| 81 | 81 | if !bar.Completed() { |
| 82 | t.Fail() | |
| 82 | t.Error("expected bar to complete") | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | p.Wait() |
| 99 | 99 | } { |
| 100 | 100 | f() |
| 101 | 101 | if bar.Completed() { |
| 102 | t.Fail() | |
| 102 | t.Error("expected bar not to complete") | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | bar.EnableTriggerComplete() |
| 107 | 107 | |
| 108 | 108 | if !bar.Completed() { |
| 109 | t.Fail() | |
| 109 | t.Error("expected bar to complete") | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if current := bar.Current(); current != targetTotal { |
| 131 | 131 | } { |
| 132 | 132 | f() |
| 133 | 133 | if bar.Completed() { |
| 134 | t.Fail() | |
| 134 | t.Error("expected bar not to complete") | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | bar.IncrBy(20) |
| 139 | 139 | |
| 140 | 140 | if !bar.Completed() { |
| 141 | t.Fail() | |
| 141 | t.Error("expected bar to complete") | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if current := bar.Current(); current != targetTotal { |