Browse code

add test

Victor Vieux authored on 2013/11/29 09:28:31
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+package utils
1
+
2
+import (
3
+	"testing"
4
+)
5
+
6
+func TestError(t *testing.T) {
7
+	je := JSONError{404, "Not found"}
8
+	if je.Error() != "Not found" {
9
+		t.Fatalf("Expected 'Not found' got '%s'", je.Error())
10
+	}
11
+}
12
+
13
+func TestProgress(t *testing.T) {
14
+	jp := JSONProgress{0, 0, 0}
15
+	if jp.String() != "" {
16
+		t.Fatalf("Expected empty string, got '%s'", jp.String())
17
+	}
18
+
19
+	jp2 := JSONProgress{1, 0, 0}
20
+	if jp2.String() != "     1 B/?" {
21
+		t.Fatalf("Expected '     1/?', got '%s'", jp2.String())
22
+	}
23
+}