mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
add test
This commit is contained in:
24
utils/jsonmessage_test.go
Normal file
24
utils/jsonmessage_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestError(t *testing.T) {
|
||||
je := JSONError{404, "Not found"}
|
||||
if je.Error() != "Not found" {
|
||||
t.Fatalf("Expected 'Not found' got '%s'", je.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestProgress(t *testing.T) {
|
||||
jp := JSONProgress{0, 0, 0}
|
||||
if jp.String() != "" {
|
||||
t.Fatalf("Expected empty string, got '%s'", jp.String())
|
||||
}
|
||||
|
||||
jp2 := JSONProgress{1, 0, 0}
|
||||
if jp2.String() != " 1 B/?" {
|
||||
t.Fatalf("Expected ' 1/?', got '%s'", jp2.String())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user