mirror of
https://github.com/restic/restic.git
synced 2025-12-02 13:52:02 +00:00
Renames to fix clashes with reserved words.
This commit is contained in:
@@ -53,12 +53,12 @@ func FormatDuration(d time.Duration) string {
|
||||
func FormatSeconds(sec uint64) string {
|
||||
hours := sec / 3600
|
||||
sec -= hours * 3600
|
||||
min := sec / 60
|
||||
sec -= min * 60
|
||||
mins := sec / 60
|
||||
sec -= mins * 60
|
||||
if hours > 0 {
|
||||
return fmt.Sprintf("%d:%02d:%02d", hours, min, sec)
|
||||
return fmt.Sprintf("%d:%02d:%02d", hours, mins, sec)
|
||||
}
|
||||
return fmt.Sprintf("%d:%02d", min, sec)
|
||||
return fmt.Sprintf("%d:%02d", mins, sec)
|
||||
}
|
||||
|
||||
// ParseBytes parses a size in bytes from s. It understands the suffixes
|
||||
|
||||
@@ -29,8 +29,8 @@ func NewCounter(interval time.Duration, total uint64, report Func) *Counter {
|
||||
max: total,
|
||||
}
|
||||
c.Updater = *NewUpdater(interval, func(runtime time.Duration, final bool) {
|
||||
v, max := c.Get()
|
||||
report(v, max, runtime, final)
|
||||
v, maxV := c.Get()
|
||||
report(v, maxV, runtime, final)
|
||||
})
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -24,34 +24,34 @@ func TestSetStatus(t *testing.T) {
|
||||
go term.Run(ctx)
|
||||
|
||||
const (
|
||||
clear = posixControlClearLine
|
||||
home = posixControlMoveCursorHome
|
||||
up = posixControlMoveCursorUp
|
||||
cl = posixControlClearLine
|
||||
home = posixControlMoveCursorHome
|
||||
up = posixControlMoveCursorUp
|
||||
)
|
||||
|
||||
term.SetStatus([]string{"first"})
|
||||
exp := home + clear + "first" + home
|
||||
exp := home + cl + "first" + home
|
||||
|
||||
term.SetStatus([]string{""})
|
||||
exp += home + clear + "" + home
|
||||
exp += home + cl + "" + home
|
||||
|
||||
term.SetStatus([]string{})
|
||||
exp += home + clear + "" + home
|
||||
exp += home + cl + "" + home
|
||||
|
||||
// already empty status
|
||||
term.SetStatus([]string{})
|
||||
|
||||
term.SetStatus([]string{"foo", "bar", "baz"})
|
||||
exp += home + clear + "foo\n" + home + clear + "bar\n" +
|
||||
home + clear + "baz" + home + up + up
|
||||
exp += home + cl + "foo\n" + home + cl + "bar\n" +
|
||||
home + cl + "baz" + home + up + up
|
||||
|
||||
term.SetStatus([]string{"quux", "needs\nquote"})
|
||||
exp += home + clear + "quux\n" +
|
||||
home + clear + "\"needs\\nquote\"\n" +
|
||||
home + clear + home + up + up // Clear third line
|
||||
exp += home + cl + "quux\n" +
|
||||
home + cl + "\"needs\\nquote\"\n" +
|
||||
home + cl + home + up + up // Clear third line
|
||||
|
||||
cancel()
|
||||
exp += home + clear + "\n" + home + clear + home + up // Status cleared
|
||||
exp += home + cl + "\n" + home + cl + home + up // Status cleared
|
||||
|
||||
<-term.closed
|
||||
rtest.Equals(t, exp, buf.String())
|
||||
|
||||
Reference in New Issue
Block a user