Skip to content

Commit

Permalink
Using character a as date times token (#5)
Browse files Browse the repository at this point in the history
- Update unit tests
  • Loading branch information
cnmlgbgithub authored Aug 2, 2023
1 parent aee513b commit 2d5eeba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nfp.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
Whitespace = " "
Zero = "0"
// DatesTimesCodeChars defined dates and times control codes in upper case
DatesTimesCodeChars = "EYMDHSG"
DatesTimesCodeChars = "AEYMDHSG"
// NumCodeChars defined numeric code character
NumCodeChars = "0123456789"
// Token section types
Expand Down
6 changes: 3 additions & 3 deletions nfp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var testStrings [][]string = [][]string{
{`[$-]`, "[{Positive [{[$-] CurrencyLanguage []}]}]"},
{"[$-ja-JP-x-gannen,80]", "[{Positive [{[$-ja-JP-x-gannen,80] CurrencyLanguage [{{ja CurrencyString []} } {{JP-x-gannen,80 LanguageInfo []} }]}]}]"},
{"x0.00", "[{Positive [{x Literal []} {0 ZeroPlaceHolder []} {. DecimalPoint []} {00 ZeroPlaceHolder []}]}]"},
{"0.0abc00", "[{Positive [{0 ZeroPlaceHolder []} {. DecimalPoint []} {0 ZeroPlaceHolder []} {abc Literal []} {00 ZeroPlaceHolder []}]}]"},
{"0.0bc00", "[{Positive [{0 ZeroPlaceHolder []} {. DecimalPoint []} {0 ZeroPlaceHolder []} {bc Literal []} {00 ZeroPlaceHolder []}]}]"},
{"x00", "[{Positive [{x Literal []} {00 ZeroPlaceHolder []}]}]"},
{"1.2", "[{Positive [{1 Literal []} {. DecimalPoint []} {2 Literal []}]}]"},
{"#.2", "[{Positive [{# HashPlaceHolder []} {. DecimalPoint []} {2 Literal []}]}]"},
Expand All @@ -66,12 +66,12 @@ var testStrings [][]string = [][]string{
{`#''.#`, "[{Positive [{# HashPlaceHolder []} {. DecimalPoint []} {# HashPlaceHolder []}]}]"},
{`#"''".#`, "[{Positive [{# HashPlaceHolder []} {'' Literal []} {. DecimalPoint []} {# HashPlaceHolder []}]}]"},
{"[h]:m00m:ss", "[{Positive [{h ElapsedDateTimes []} {: Literal []} {m DateTimes []} {00 ZeroPlaceHolder []} {m DateTimes []} {: Literal []} {ss DateTimes []}]}]"},
{"abc[h]:mm:ss.0xxxx", "[{Positive [{abc Literal []} {h ElapsedDateTimes []} {: Literal []} {mm DateTimes []} {: Literal []} {ss DateTimes []} {. DecimalPoint []} {0 ZeroPlaceHolder []} {xxxx Literal []}]}]"},
{"bc[h]:mm:ss.0xxxx", "[{Positive [{bc Literal []} {h ElapsedDateTimes []} {: Literal []} {mm DateTimes []} {: Literal []} {ss DateTimes []} {. DecimalPoint []} {0 ZeroPlaceHolder []} {xxxx Literal []}]}]"},
{"[s].00.", "[{Positive [{s ElapsedDateTimes []} {. DecimalPoint []} {00 ZeroPlaceHolder []} {. DecimalPoint []}]}]"},
{"[s]\".00\"", "[{Positive [{s ElapsedDateTimes []} {. Literal []} {00 Literal []}]}]"},
{"[s].##", "[{Positive [{s ElapsedDateTimes []} {. DecimalPoint []} {## HashPlaceHolder []}]}]"},
{`上午/下午h"时"mm"分"ss"秒";@`, "[{Positive [{上午/下午 DateTimes []} {h DateTimes []} {时 Literal []} {mm DateTimes []} {分 Literal []} {ss DateTimes []} {秒 Literal []}]} {Text [{@ TextPlaceHolder []}]}]"},
{`abcdefghijklmnopqrstuvwxyz`, "[{Positive [{abc Literal []} {d DateTimes []} {e DateTimes []} {f Literal []} {g DateTimes []} {h DateTimes []} {ijkl Literal []} {m DateTimes []} {nopqr Literal []} {s DateTimes []} {tuvwx Literal []} {y DateTimes []} {z Literal []}]}]"},
{`abcdefghijklmnopqrstuvwxyz`, "[{Positive [{a DateTimes []} {bc Literal []} {d DateTimes []} {e DateTimes []} {f Literal []} {g DateTimes []} {h DateTimes []} {ijkl Literal []} {m DateTimes []} {nopqr Literal []} {s DateTimes []} {tuvwx Literal []} {y DateTimes []} {z Literal []}]}]"},
{`oeopwierop`, "[{Positive [{o Literal []} {e DateTimes []} {opwi Literal []} {e DateTimes []} {rop Literal []}]}]"},
{`[DBNum1][$US-111]yyyy"年"m"月"d"日";@`, "[{Positive [{[DBNum1] SwitchArgument []} {[$US-111] CurrencyLanguage [{{US CurrencyString []} } {{111 LanguageInfo []} }]} {yyyy DateTimes []} {年 Literal []} {m DateTimes []} {月 Literal []} {d DateTimes []} {日 Literal []}]} {Text [{@ TextPlaceHolder []}]}]"},
{`上午/下午 hh"時"mm"分"ss"秒"`, "[{Positive [{上午/下午 DateTimes []} {hh DateTimes []} {時 Literal []} {mm DateTimes []} {分 Literal []} {ss DateTimes []} {秒 Literal []}]}]"},
Expand Down

0 comments on commit 2d5eeba

Please sign in to comment.