|
223 | 223 |
|
224 | 224 | # #5864
|
225 | 225 | it "raises RangeError if self is invalid as a codepoint in the specified encoding" do
|
226 |
| - [ [0x80, "US-ASCII"], |
227 |
| - [0x0100, "BINARY"], |
228 |
| - [0x0100, "EUC-JP"], |
229 |
| - [0xA1A0, "EUC-JP"], |
230 |
| - [0xA1, "EUC-JP"], |
231 |
| - [0x80, "SHIFT_JIS"], |
232 |
| - [0xE0, "SHIFT_JIS"], |
233 |
| - [0x0100, "ISO-8859-9"], |
234 |
| - [620, "TIS-620"], |
235 |
| - [0xD800, "UTF-8"], |
236 |
| - [0xDBFF, "UTF-8"], |
237 |
| - [0xDC00, "UTF-8"], |
238 |
| - [0xDFFF, "UTF-8"], |
239 |
| - [0xD800, "UTF-16"], |
240 |
| - [0xDBFF, "UTF-16"], |
241 |
| - [0xDC00, "UTF-16"], |
242 |
| - [0xDFFF, "UTF-16"], |
243 |
| - ].each do |integer, encoding_name| |
244 |
| - -> { integer.chr(encoding_name) }.should raise_error(RangeError) |
245 |
| - end |
| 226 | + -> { 0x80.chr("US-ASCII") }.should raise_error(RangeError) |
| 227 | + -> { 0x0100.chr("BINARY") }.should raise_error(RangeError) |
| 228 | + -> { 0x0100.chr("EUC-JP") }.should raise_error(RangeError) |
| 229 | + -> { 0xA1A0.chr("EUC-JP") }.should raise_error(RangeError) |
| 230 | + -> { 0xA1.chr("EUC-JP") }.should raise_error(RangeError) |
| 231 | + -> { 0x80.chr("SHIFT_JIS") }.should raise_error(RangeError) |
| 232 | + -> { 0xE0.chr("SHIFT_JIS") }.should raise_error(RangeError) |
| 233 | + -> { 0x0100.chr("ISO-8859-9") }.should raise_error(RangeError) |
| 234 | + -> { 620.chr("TIS-620") }.should raise_error(RangeError) |
| 235 | + # UTF-16 surrogate range |
| 236 | + -> { 0xD800.chr("UTF-8") }.should raise_error(RangeError) |
| 237 | + -> { 0xDBFF.chr("UTF-8") }.should raise_error(RangeError) |
| 238 | + -> { 0xDC00.chr("UTF-8") }.should raise_error(RangeError) |
| 239 | + -> { 0xDFFF.chr("UTF-8") }.should raise_error(RangeError) |
| 240 | + # UTF-16 surrogate range |
| 241 | + -> { 0xD800.chr("UTF-16") }.should raise_error(RangeError) |
| 242 | + -> { 0xDBFF.chr("UTF-16") }.should raise_error(RangeError) |
| 243 | + -> { 0xDC00.chr("UTF-16") }.should raise_error(RangeError) |
| 244 | + -> { 0xDFFF.chr("UTF-16") }.should raise_error(RangeError) |
246 | 245 | end
|
247 | 246 |
|
248 | 247 | it 'returns a String encoding self interpreted as a codepoint in the CESU-8 encoding' do
|
|
0 commit comments