github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/parse/read/range_test.go (about) 1 package read_test 2 3 import ( 4 "testing" 5 "github.com/v2pro/plz/test" 6 "github.com/v2pro/plz/countlog" 7 "unicode" 8 "github.com/v2pro/plz/parse/read" 9 "github.com/v2pro/plz/parse" 10 "github.com/v2pro/plz/test/must" 11 ) 12 13 func TestUnicodeRanges(t *testing.T) { 14 t.Run("complex range", test.Case(func(ctx *countlog.Context) { 15 src := parse.NewSourceString("ab中文c,") 16 id := read.UnicodeRanges(src, nil, nil, []*unicode.RangeTable{ 17 unicode.Pattern_Syntax, 18 unicode.Pattern_White_Space, 19 }) 20 must.Equal("ab中文c", string(id)) 21 })) 22 }