@@ -123,21 +123,23 @@ pure fn to_digit(c: char, radix: uint) -> option<uint> {
123
123
}
124
124
125
125
/*
126
- FIXME: works only on ASCII
126
+ FIXME: works only on ASCII (Issue #1985)
127
127
*/
128
128
#[ doc = "Convert a char to the corresponding lower case." ]
129
129
pure fn to_lower ( c : char ) -> char {
130
+ assert is_ascii ( c) ;
130
131
alt c {
131
132
'A' to 'Z' { ( ( c as u8 ) + 32u8 ) as char }
132
133
_ { c }
133
134
}
134
135
}
135
136
136
137
/*
137
- FIXME: works only on ASCII
138
+ FIXME: works only on ASCII (Issue 1985)
138
139
*/
139
140
#[ doc = "Convert a char to the corresponding upper case." ]
140
141
pure fn to_upper ( c : char ) -> char {
142
+ assert is_ascii ( c) ;
141
143
alt c {
142
144
'a' to 'z' { ( ( c as u8 ) - 32u8 ) as char }
143
145
_ { c }
@@ -208,16 +210,18 @@ fn test_to_digit() {
208
210
fn test_to_lower ( ) {
209
211
assert ( to_lower ( 'H' ) == 'h' ) ;
210
212
assert ( to_lower ( 'e' ) == 'e' ) ;
213
+ // non-ASCII, shouldn't work (see earlier FIXME)
211
214
//assert (to_lower('Ö') == 'ö');
212
- assert ( to_lower ( 'ß' ) == 'ß' ) ;
215
+ // assert (to_lower('ß') == 'ß');
213
216
}
214
217
215
218
#[ test]
216
219
fn test_to_upper ( ) {
217
220
assert ( to_upper ( 'l' ) == 'L' ) ;
218
221
assert ( to_upper ( 'Q' ) == 'Q' ) ;
222
+ // non-ASCII, shouldn't work (see earlier FIXME)
219
223
//assert (to_upper('ü') == 'Ü');
220
- assert ( to_upper ( 'ß' ) == 'ß' ) ;
224
+ // assert (to_upper('ß') == 'ß');
221
225
}
222
226
223
227
#[ test]
0 commit comments