Debian Codegraph @

localeinfo_test.go

raw symbols SCIP
1 package localeinfo
2
3 import (
4 "testing"
5 "time"
6 )
7
8 func assert(t *testing.T, got string, want string, fmt string) {
9 if want == got {
10 return
11 }
12 t.Errorf(fmt+": want: %v: got: %v", want, got)
13 t.FailNow()
14 }
15
16 func TestDateFmt(t *testing.T) {
17 l, err := NewLocale("C.UTF-8")
18 if err != nil {
19 t.Errorf("NewLocale: %v", err)
20 return
21 }
22 assert(t, l.DateFormat(), "%m/%d/%y", "DateFormat")
23 assert(t, l.DateTimeFormat(), "%a %b %e %H:%M:%S %Y", "DateTimeFormat")
24 assert(t, l.Month(time.February), "February", "Month")
25 assert(t, l.Day(time.Friday), "Friday", "Day")
26 assert(t, l.AM(), "AM", "AM")
27 assert(t, l.PM(), "PM", "PM")
28 s, _ := l.Currency()
29 assert(t, s, "", "Currency")
30 assert(t, l.Encoding(), "UTF-8", "Encoding")
31 assert(t, l.Radix(), ".", "Radix")
32 assert(t, l.ThousandSeparator(), "", "ThousandSeparator")
33 assert(t, l.TimeFormat(), "%H:%M:%S", "TimeFormat")
34 assert(t, l.TimeAMPMFormat(), "%I:%M:%S %p", "TimeAMPMFormat")
35 assert(t, l.ShortDay(time.Wednesday), "Wed", "ShortDay")
36 assert(t, l.ShortMonth(time.July), "Jul", "ShortMonth")
37 }