mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
jsonmessage: added test and cleaned up others
Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
parent
77237be0e2
commit
704b97d1c4
1 changed files with 13 additions and 4 deletions
|
@ -17,13 +17,22 @@ func TestProgress(t *testing.T) {
|
|||
t.Fatalf("Expected empty string, got '%s'", jp.String())
|
||||
}
|
||||
|
||||
expected := " 1 B"
|
||||
jp2 := JSONProgress{Current: 1}
|
||||
if jp2.String() != " 1 B" {
|
||||
t.Fatalf("Expected ' 1 B', got '%s'", jp2.String())
|
||||
if jp2.String() != expected {
|
||||
t.Fatalf("Expected %q, got %q", expected, jp2.String())
|
||||
}
|
||||
|
||||
expected = "[=========================> ] 50 B/100 B"
|
||||
jp3 := JSONProgress{Current: 50, Total: 100}
|
||||
if jp3.String() != "[=========================> ] 50 B/100 B" {
|
||||
t.Fatalf("Expected '[=========================> ] 50 B/100 B', got '%s'", jp3.String())
|
||||
if jp3.String() != expected {
|
||||
t.Fatalf("Expected %q, got %q", expected, jp3.String())
|
||||
}
|
||||
|
||||
// this number can't be negetive gh#7136
|
||||
expected = "[==============================================================>] 50 B/40 B"
|
||||
jp4 := JSONProgress{Current: 50, Total: 40}
|
||||
if jp4.String() != expected {
|
||||
t.Fatalf("Expected %q, got %q", expected, jp4.String())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue