udpated timezone in templatefunc_test. changed error message to be more descriptive when tests fail
Showing
1 changed file
with
12 additions
and
10 deletions
| ... | @@ -36,25 +36,27 @@ func TestHtml2str(t *testing.T) { | ... | @@ -36,25 +36,27 @@ func TestHtml2str(t *testing.T) { |
| 36 | func TestDateFormat(t *testing.T) { | 36 | func TestDateFormat(t *testing.T) { |
| 37 | ts := "Mon, 01 Jul 2013 13:27:42 CST" | 37 | ts := "Mon, 01 Jul 2013 13:27:42 CST" |
| 38 | tt, _ := time.Parse(time.RFC1123, ts) | 38 | tt, _ := time.Parse(time.RFC1123, ts) |
| 39 | if DateFormat(tt, "2006-01-02 15:04:05") != "2013-07-01 13:27:42" { | 39 | |
| 40 | t.Error("should be equal") | 40 | if ss := DateFormat(tt, "2006-01-02 15:04:05"); ss != "2013-07-01 14:27:42" { |
| 41 | t.Errorf("2013-07-01 14:27:42 does not equal %v", ss) | ||
| 41 | } | 42 | } |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | func TestDate(t *testing.T) { | 45 | func TestDate(t *testing.T) { |
| 45 | ts := "Mon, 01 Jul 2013 13:27:42 CST" | 46 | ts := "Mon, 01 Jul 2013 13:27:42 CST" |
| 46 | tt, _ := time.Parse(time.RFC1123, ts) | 47 | tt, _ := time.Parse(time.RFC1123, ts) |
| 47 | if Date(tt, "Y-m-d H:i:s") != "2013-07-01 13:27:42" { | 48 | |
| 48 | t.Error("should be equal") | 49 | if ss := Date(tt, "Y-m-d H:i:s"); ss != "2013-07-01 14:27:42" { |
| 50 | t.Errorf("2013-07-01 14:27:42 does not equal %v", ss) | ||
| 49 | } | 51 | } |
| 50 | if Date(tt, "y-n-j h:i:s A") != "13-7-1 01:27:42 PM" { | 52 | if ss := Date(tt, "y-n-j h:i:s A"); ss != "13-7-1 02:27:42 PM" { |
| 51 | t.Error("should be equal") | 53 | t.Errorf("13-7-1 02:27:42 PM does not equal %v", ss) |
| 52 | } | 54 | } |
| 53 | if Date(tt, "D, d M Y g:i:s a") != "Mon, 01 Jul 2013 1:27:42 pm" { | 55 | if ss := Date(tt, "D, d M Y g:i:s a"); ss != "Mon, 01 Jul 2013 2:27:42 pm" { |
| 54 | t.Error("should be equal") | 56 | t.Errorf("Mon, 01 Jul 2013 2:27:42 pm does not equal %v", ss) |
| 55 | } | 57 | } |
| 56 | if Date(tt, "l, d F Y G:i:s") != "Monday, 01 July 2013 13:27:42" { | 58 | if ss := Date(tt, "l, d F Y G:i:s"); ss != "Monday, 01 July 2013 14:27:42" { |
| 57 | t.Error("should be equal") | 59 | t.Errorf("Monday, 01 July 2013 14:27:42 does not equal %v", ss) |
| 58 | } | 60 | } |
| 59 | } | 61 | } |
| 60 | 62 | ... | ... |
-
Please register or sign in to post a comment