File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,3 +65,19 @@ func TestLookupType(t *testing.T) {
6565 assertions .Equal ([]string {"if" , "for" }, result .Words )
6666 assertions .Equal (false , result .CaseSensitive )
6767}
68+
69+ func TestLookupTypeNotFound (t * testing.T ) {
70+ assertions := assert .New (t )
71+
72+ tokenTypes := []TokenType {}
73+ tokenTypes = append (tokenTypes , TokenType {
74+ Type : "keyword" ,
75+ Words : []string {"if" , "for" },
76+ CaseSensitive : false ,
77+ })
78+
79+ result := LookupType ("var" , tokenTypes )
80+ assertions .Equal ("" , result .Type )
81+ assertions .Equal ([]string {"" }, result .Words )
82+ assertions .Equal (false , result .CaseSensitive )
83+ }
Original file line number Diff line number Diff line change @@ -237,3 +237,34 @@ func TestWordSplit(t *testing.T) {
237237 result = WordSplit ("" )
238238 assertions .Equal ([]string {"" }, result )
239239}
240+
241+ func TestIsAlphabet (t * testing.T ) {
242+ assertions := assert .New (t )
243+
244+ result := IsAlphabet ('a' )
245+ assertions .True (result )
246+
247+ result = IsAlphabet ('Á' )
248+ assertions .True (result )
249+
250+ result = IsAlphabet ('ç' )
251+ assertions .True (result )
252+
253+ result = IsAlphabet ('æ' )
254+ assertions .True (result )
255+
256+ result = IsAlphabet ('中' )
257+ assertions .False (result )
258+
259+ result = IsAlphabet ('🎯' )
260+ assertions .False (result )
261+
262+ result = IsAlphabet ('\u4E00' )
263+ assertions .False (result )
264+
265+ result = IsAlphabet ('\u3400' )
266+ assertions .False (result )
267+
268+ result = IsAlphabet ('\U00020000' )
269+ assertions .False (result )
270+ }
You can’t perform that action at this time.
0 commit comments