1
0
Fork 0
datetime.link/template_test.go

28 lines
662 B
Go

package main
import (
"testing"
)
func TestTemplateFuncFormatOffset(t *testing.T) {
want, got := "+06:06", templateFuncFormatOffset(6*60*60+6*60)
if want != got {
t.Fatalf("got offset %v, want offset %v", got, want)
}
want, got = "-12:15", templateFuncFormatOffset(-(12*60*60 + 15*60))
if want != got {
t.Fatalf("got offset %v, want offset %v", got, want)
}
want, got = "\u00B100:00", templateFuncFormatOffset(-(0*60*60 + 0*60))
if want != got {
t.Fatalf("got offset %v, want offset %v", got, want)
}
want, got = "+00:01", templateFuncFormatOffset(0*60*60+1*60)
if want != got {
t.Fatalf("got offset %v, want offset %v", got, want)
}
}