data_test.go 4.7 KB

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