@@ -10,9 +10,7 @@ import (
10
10
"strings"
11
11
"testing"
12
12
13
- "golang.org/x/text/internal/gen"
14
13
"golang.org/x/text/internal/testtext"
15
- "golang.org/x/text/internal/ucd"
16
14
)
17
15
18
16
func TestAllocToUnicode (t * testing.T ) {
@@ -101,68 +99,6 @@ func doTest(t *testing.T, f func(string) (string, error), name, input, want, err
101
99
})
102
100
}
103
101
104
- func TestConformance (t * testing.T ) {
105
- testtext .SkipIfNotLong (t )
106
-
107
- r := gen .OpenUnicodeFile ("idna" , "" , "IdnaTest.txt" )
108
- defer r .Close ()
109
-
110
- section := "main"
111
- started := false
112
- p := ucd .New (r , ucd .CommentHandler (func (s string ) {
113
- if started {
114
- section = strings .ToLower (strings .Split (s , " " )[0 ])
115
- }
116
- }))
117
- transitional := New (Transitional (true ), VerifyDNSLength (true ), BidiRule (), MapForLookup ())
118
- nonTransitional := New (VerifyDNSLength (true ), BidiRule (), MapForLookup ())
119
- for p .Next () {
120
- started = true
121
-
122
- // What to test
123
- profiles := []* Profile {}
124
- switch p .String (0 ) {
125
- case "T" :
126
- profiles = append (profiles , transitional )
127
- case "N" :
128
- profiles = append (profiles , nonTransitional )
129
- case "B" :
130
- profiles = append (profiles , transitional )
131
- profiles = append (profiles , nonTransitional )
132
- }
133
-
134
- src := unescape (p .String (1 ))
135
-
136
- wantToUnicode := unescape (p .String (2 ))
137
- if wantToUnicode == "" {
138
- wantToUnicode = src
139
- }
140
- wantToASCII := unescape (p .String (3 ))
141
- if wantToASCII == "" {
142
- wantToASCII = wantToUnicode
143
- }
144
- wantErrToUnicode := ""
145
- if strings .HasPrefix (wantToUnicode , "[" ) {
146
- wantErrToUnicode = wantToUnicode
147
- wantToUnicode = ""
148
- }
149
- wantErrToASCII := ""
150
- if strings .HasPrefix (wantToASCII , "[" ) {
151
- wantErrToASCII = wantToASCII
152
- wantToASCII = ""
153
- }
154
-
155
- // TODO: also do IDNA tests.
156
- // invalidInIDNA2008 := p.String(4) == "NV8"
157
-
158
- for _ , p := range profiles {
159
- name := fmt .Sprintf ("%s:%s" , section , p )
160
- doTest (t , p .ToUnicode , name + ":ToUnicode" , src , wantToUnicode , wantErrToUnicode )
161
- doTest (t , p .ToASCII , name + ":ToASCII" , src , wantToASCII , wantErrToASCII )
162
- }
163
- }
164
- }
165
-
166
102
func unescape (s string ) string {
167
103
s , err := strconv .Unquote (`"` + s + `"` )
168
104
if err != nil {
0 commit comments