github.com/go-xe2/third@v1.0.3/golang.org/x/text/unicode/cldr/data_test.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package cldr 6 7 // This file contains test data. 8 9 import ( 10 "io" 11 "strings" 12 ) 13 14 type testLoader struct { 15 } 16 17 func (t testLoader) Len() int { 18 return len(testFiles) 19 } 20 21 func (t testLoader) Path(i int) string { 22 return testPaths[i] 23 } 24 25 func (t testLoader) Reader(i int) (io.ReadCloser, error) { 26 return &reader{*strings.NewReader(testFiles[i])}, nil 27 } 28 29 // reader adds a dummy Close method to strings.Reader so that it 30 // satisfies the io.ReadCloser interface. 31 type reader struct { 32 strings.Reader 33 } 34 35 func (r reader) Close() error { 36 return nil 37 } 38 39 var ( 40 testFiles = []string{de_xml, gsw_xml, root_xml} 41 testPaths = []string{ 42 "common/main/de.xml", 43 "common/main/gsw.xml", 44 "common/main/root.xml", 45 } 46 ) 47 48 var root_xml = `<?xml version="1.0" encoding="UTF-8" ?> 49 <!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd"> 50 <ldml> 51 <identity> 52 <language type="root"/> 53 <generation date="now"/> 54 </identity> 55 <characters> 56 <exemplarCharacters>[]</exemplarCharacters> 57 <exemplarCharacters type="auxiliary">[]</exemplarCharacters> 58 <exemplarCharacters type="punctuation">[\- ‐ – — … ' ‘ ‚ " “ „ \& #]</exemplarCharacters> 59 <ellipsis type="final">{0}…</ellipsis> 60 <ellipsis type="initial">…{0}</ellipsis> 61 <moreInformation>?</moreInformation> 62 </characters> 63 <dates> 64 <calendars> 65 <default choice="gregorian"/> 66 <calendar type="buddhist"> 67 <months> 68 <alias source="locale" path="../../calendar[@type='gregorian']/months"/> 69 </months> 70 </calendar> 71 <calendar type="chinese"> 72 <months> 73 <alias source="locale" path="../../calendar[@type='gregorian']/months"/> 74 </months> 75 </calendar> 76 <calendar type="gregorian"> 77 <months> 78 <default choice="format"/> 79 <monthContext type="format"> 80 <default choice="wide"/> 81 <monthWidth type="narrow"> 82 <alias source="locale" path="../../monthContext[@type='stand-alone']/monthWidth[@type='narrow']"/> 83 </monthWidth> 84 <monthWidth type="wide"> 85 <month type="1">11</month> 86 <month type="2">22</month> 87 <month type="3">33</month> 88 <month type="4">44</month> 89 </monthWidth> 90 </monthContext> 91 <monthContext type="stand-alone"> 92 <monthWidth type="narrow"> 93 <month type="1">1</month> 94 <month type="2">2</month> 95 <month type="3">3</month> 96 <month type="4">4</month> 97 </monthWidth> 98 <monthWidth type="wide"> 99 <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='wide']"/> 100 </monthWidth> 101 </monthContext> 102 </months> 103 </calendar> 104 </calendars> 105 </dates> 106 </ldml> 107 ` 108 109 var de_xml = `<?xml version="1.0" encoding="UTF-8" ?> 110 <!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd"> 111 <ldml> 112 <identity> 113 <language type="de"/> 114 </identity> 115 <characters> 116 <exemplarCharacters>[a ä b c d e ö p q r s ß t u ü v w x y z]</exemplarCharacters> 117 <exemplarCharacters type="auxiliary">[á à ă]</exemplarCharacters> 118 <exemplarCharacters type="index">[A B C D E F G H Z]</exemplarCharacters> 119 <ellipsis type="final">{0} …</ellipsis> 120 <ellipsis type="initial">… {0}</ellipsis> 121 <moreInformation>?</moreInformation> 122 <stopwords> 123 <stopwordList type="collation" draft="provisional">der die das</stopwordList> 124 </stopwords> 125 </characters> 126 <dates> 127 <calendars> 128 <calendar type="buddhist"> 129 <months> 130 <monthContext type="format"> 131 <monthWidth type="narrow"> 132 <month type="3">BBB</month> 133 </monthWidth> 134 <monthWidth type="wide"> 135 <month type="3">bbb</month> 136 </monthWidth> 137 </monthContext> 138 </months> 139 </calendar> 140 <calendar type="gregorian"> 141 <months> 142 <monthContext type="format"> 143 <monthWidth type="narrow"> 144 <month type="3">M</month> 145 <month type="4">A</month> 146 </monthWidth> 147 <monthWidth type="wide"> 148 <month type="3">Maerz</month> 149 <month type="4">April</month> 150 <month type="5">Mai</month> 151 </monthWidth> 152 </monthContext> 153 <monthContext type="stand-alone"> 154 <monthWidth type="narrow"> 155 <month type="3">m</month> 156 <month type="5">m</month> 157 </monthWidth> 158 <monthWidth type="wide"> 159 <month type="4">april</month> 160 <month type="5">mai</month> 161 </monthWidth> 162 </monthContext> 163 </months> 164 </calendar> 165 </calendars> 166 </dates> 167 <posix> 168 <messages> 169 <yesstr>yes:y</yesstr> 170 <nostr>no:n</nostr> 171 </messages> 172 </posix> 173 </ldml> 174 ` 175 176 var gsw_xml = `<?xml version="1.0" encoding="UTF-8" ?> 177 <!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd"> 178 <ldml> 179 <identity> 180 <language type="gsw"/> 181 </identity> 182 <posix> 183 <alias source="de" path="//ldml/posix"/> 184 </posix> 185 </ldml> 186 `