12345678910111213141516171819202122232425262728293031323334 |
- package regexp_test
- import (
- "fmt"
- "regexp"
- "testing"
- "github.com/issue9/assert"
- )
- func TestAll(t *testing.T) {
- fmt.Println("\ufffc")
- regxTest(t, ``)
- regxTest(t, `中文`)
- regxTest(t, "\\\\")
- regxTest(t, `\\u00ff`)
- regxTest(t, "\uffff")
- regxTest(t, "\u0100")
- for i := 0; i < 65536; i++ {
- // fmt.Println(fmt.Sprintf("%c", i))
- regxTest(t, fmt.Sprintf("%c", i))
- }
- fmt.Println()
- }
- func regxTest(t *testing.T, s string) {
- re, e := regexp.Compile(s)
- if re != nil {
- assert.True(t, re.MatchString(s))
- } else {
- fmt.Print(s, " ")
- }
- assert.Nil(t, e)
- }
|