Skip to content

Commit a1745b5

Browse files
author
Lenny222
committed
---
yaml --- r: 6944 b: refs/heads/master c: eb0cdc0 h: refs/heads/master v: v3
1 parent 459982d commit a1745b5

File tree

6 files changed

+40
-79
lines changed

6 files changed

+40
-79
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 900bc1298df011bfb094858b11cdfd8d6b01418c
2+
refs/heads/master: eb0cdc02e3b443fe119cb4957856a63dbd5923d4

trunk/src/libcore/char.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ import is_alphabetic = unicode::derived_property::Alphabetic;
4141
import is_XID_start = unicode::derived_property::XID_Start;
4242
import is_XID_continue = unicode::derived_property::XID_Continue;
4343

44+
/*
45+
Function: is_lowercase
46+
47+
Indicates whether a character is in lower case, defined in terms of the
48+
Unicode General Category 'Ll'.
49+
*/
50+
pure fn is_lowercase(c: char) -> bool {
51+
ret unicode::general_category::Ll(c);
52+
}
53+
54+
/*
55+
Function: is_uppercase
56+
57+
Indicates whether a character is in upper case, defined in terms of the
58+
Unicode General Category 'Lu'.
59+
*/
60+
pure fn is_uppercase(c: char) -> bool {
61+
ret unicode::general_category::Lu(c);
62+
}
63+
4464
/*
4565
Function: is_whitespace
4666
@@ -126,4 +146,4 @@ pure fn cmp(a: char, b: char) -> int {
126146
ret if b > a { -1 }
127147
else if b < a { 1 }
128148
else { 0 }
129-
}
149+
}

trunk/src/libstd/unicode.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ mod icu {
152152
#[abi = "cdecl"]
153153
native mod libicu {
154154
pure fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
155-
pure fn u_isdigit(c: UChar32) -> UBool;
156-
pure fn u_islower(c: UChar32) -> UBool;
157-
pure fn u_isspace(c: UChar32) -> UBool;
158-
pure fn u_isupper(c: UChar32) -> UBool;
159-
pure fn u_tolower(c: UChar32) -> UChar32;
160-
pure fn u_toupper(c: UChar32) -> UChar32;
161155
}
162156
}
163157

@@ -170,40 +164,3 @@ pure fn is_XID_continue(c: char) -> bool {
170164
ret icu::libicu::u_hasBinaryProperty(c, icu::UCHAR_XID_START)
171165
== icu::TRUE;
172166
}
173-
174-
/*
175-
Function: is_digit
176-
177-
Returns true if a character is a digit.
178-
*/
179-
pure fn is_digit(c: char) -> bool {
180-
ret icu::libicu::u_isdigit(c) == icu::TRUE;
181-
}
182-
183-
/*
184-
Function: is_lower
185-
186-
Returns true if a character is a lowercase letter.
187-
*/
188-
pure fn is_lower(c: char) -> bool {
189-
ret icu::libicu::u_islower(c) == icu::TRUE;
190-
}
191-
192-
/*
193-
Function: is_space
194-
195-
Returns true if a character is space.
196-
*/
197-
pure fn is_space(c: char) -> bool {
198-
ret icu::libicu::u_isspace(c) == icu::TRUE;
199-
}
200-
201-
/*
202-
Function: is_upper
203-
204-
Returns true if a character is an uppercase letter.
205-
*/
206-
pure fn is_upper(c: char) -> bool {
207-
ret icu::libicu::u_isupper(c) == icu::TRUE;
208-
}
209-

trunk/src/test/stdtest/char.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ import core::*;
33
use std;
44
import char;
55

6+
#[test]
7+
fn test_is_lowercase() {
8+
assert char::is_lowercase('a');
9+
assert char::is_lowercase('ö');
10+
assert char::is_lowercase('ß');
11+
assert !char::is_lowercase('Ü');
12+
assert !char::is_lowercase('P');
13+
}
14+
15+
#[test]
16+
fn test_is_uppercase() {
17+
assert !char::is_uppercase('h');
18+
assert !char::is_uppercase('ä');
19+
assert !char::is_uppercase('ß');
20+
assert char::is_uppercase('Ö');
21+
assert char::is_uppercase('T');
22+
}
23+
624
#[test]
725
fn test_is_whitespace() {
826
assert char::is_whitespace(' ');

trunk/src/test/stdtest/stdtest.rc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ mod test;
3939
mod tri;
4040
mod treemap;
4141
mod uint;
42-
43-
#[cfg(unicode)]
44-
mod unicode;
45-
4642
mod unsafe;
4743
mod uv;
4844
mod vec;

trunk/src/test/stdtest/unicode.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)