diff options
| author | Stefan Plantikow <stefan.plantikow@googlemail.com> | 2012-01-05 00:11:25 +0100 |
|---|---|---|
| committer | Stefan Plantikow <stefan.plantikow@googlemail.com> | 2012-01-05 02:07:12 +0100 |
| commit | 6284190ef9918e05cb9147a2a81100ddcb06fea8 (patch) | |
| tree | e5e8075a4de03db9c4efee2b6d994343a674b3b5 /src/test/stdtest | |
| parent | 16405386f0a843167e234d8d54855a537b0f261d (diff) | |
| parent | 3971b520bcdd556ff78120c77ffd13785e1c3695 (diff) | |
| download | rust-6284190ef9918e05cb9147a2a81100ddcb06fea8.tar.gz rust-6284190ef9918e05cb9147a2a81100ddcb06fea8.zip | |
Merge branch 'master' into kmath
Conflicts: src/libcore/cmath.rs
Diffstat (limited to 'src/test/stdtest')
| -rw-r--r-- | src/test/stdtest/char.rs | 16 | ||||
| -rw-r--r-- | src/test/stdtest/list.rs | 43 | ||||
| -rw-r--r-- | src/test/stdtest/os.rs | 7 | ||||
| -rw-r--r-- | src/test/stdtest/str.rs | 6 | ||||
| -rw-r--r-- | src/test/stdtest/uv.rs | 3 |
5 files changed, 62 insertions, 13 deletions
diff --git a/src/test/stdtest/char.rs b/src/test/stdtest/char.rs index 1ed61f5632f..7da2443d6c2 100644 --- a/src/test/stdtest/char.rs +++ b/src/test/stdtest/char.rs @@ -60,3 +60,19 @@ fn test_to_digit_fail_1() { fn test_to_digit_fail_2() { char::to_digit('$'); } + +#[test] +fn test_to_lower() { + assert (char::to_lower('H') == 'h'); + assert (char::to_lower('e') == 'e'); + //assert (char::to_lower('Ö') == 'ö'); + assert (char::to_lower('ß') == 'ß'); +} + +#[test] +fn test_to_upper() { + assert (char::to_upper('l') == 'L'); + assert (char::to_upper('Q') == 'Q'); + //assert (char::to_upper('ü') == 'Ü'); + assert (char::to_upper('ß') == 'ß'); +} diff --git a/src/test/stdtest/list.rs b/src/test/stdtest/list.rs index 227e8ad299d..b96bc9cd16a 100644 --- a/src/test/stdtest/list.rs +++ b/src/test/stdtest/list.rs @@ -2,17 +2,38 @@ import core::*; use std; import std::list; -import std::list::head; -import std::list::tail; -import std::list::from_vec; +import std::list::{from_vec, head, is_empty, is_not_empty, tail}; import option; #[test] +fn test_is_empty() { + let empty : list::list<int> = from_vec([]); + let full1 = from_vec([1]); + let full2 = from_vec(['r', 'u']); + + assert is_empty(empty); + assert !is_empty(full1); + assert !is_empty(full2); + + assert !is_not_empty(empty); + assert is_not_empty(full1); + assert is_not_empty(full2); +} + +#[test] fn test_from_vec() { let l = from_vec([0, 1, 2]); + + check is_not_empty(l); assert (head(l) == 0); - assert (head(tail(l)) == 1); - assert (head(tail(tail(l))) == 2); + + let tail_l = tail(l); + check is_not_empty(tail_l); + assert (head(tail_l) == 1); + + let tail_tail_l = tail(tail_l); + check is_not_empty(tail_tail_l); + assert (head(tail_tail_l) == 2); } #[test] @@ -24,9 +45,17 @@ fn test_from_vec_empty() { #[test] fn test_from_vec_mut() { let l = from_vec([mutable 0, 1, 2]); + + check is_not_empty(l); assert (head(l) == 0); - assert (head(tail(l)) == 1); - assert (head(tail(tail(l))) == 2); + + let tail_l = tail(l); + check is_not_empty(tail_l); + assert (head(tail_l) == 1); + + let tail_tail_l = tail(tail_l); + check is_not_empty(tail_tail_l); + assert (head(tail_tail_l) == 2); } #[test] diff --git a/src/test/stdtest/os.rs b/src/test/stdtest/os.rs index 7f7b2c4f3b3..fd773063e8d 100644 --- a/src/test/stdtest/os.rs +++ b/src/test/stdtest/os.rs @@ -14,6 +14,7 @@ fn test_setenv() { } #[test] +#[ignore(reason = "fails periodically on mac")] fn test_setenv_overwrite() { setenv("NAME2", "1"); setenv("NAME2", "2"); @@ -23,12 +24,14 @@ fn test_setenv_overwrite() { // Windows GetEnvironmentVariable requires some extra work to make sure // the buffer the variable is copied into is the right size #[test] +#[ignore(reason = "fails periodically on mac")] fn test_getenv_big() { let s = ""; let i = 0; while i < 100 { s += "aaaaaaaaaa"; i += 1; } - setenv("NAME3", s); - assert (getenv("NAME3") == option::some(s)); + setenv("test_getenv_big", s); + log(debug, s); + assert (getenv("test_getenv_big") == option::some(s)); } #[test] diff --git a/src/test/stdtest/str.rs b/src/test/stdtest/str.rs index c3f0e53bac5..39217fb8a8b 100644 --- a/src/test/stdtest/str.rs +++ b/src/test/stdtest/str.rs @@ -287,10 +287,10 @@ fn unsafe_from_bytes() { } #[test] -fn str_from_cstr() unsafe { +fn from_cstr() unsafe { let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8]; let b = vec::to_ptr(a); - let c = str::str_from_cstr(b); + let c = str::from_cstr(b); assert (c == "AAAAAAA"); } @@ -312,7 +312,7 @@ fn as_buf_small() unsafe { fn as_buf2() unsafe { let s = "hello"; let sb = str::as_buf(s, {|b| b }); - let s_cstr = str::str_from_cstr(sb); + let s_cstr = str::from_cstr(sb); assert (str::eq(s_cstr, s)); } diff --git a/src/test/stdtest/uv.rs b/src/test/stdtest/uv.rs index 5529ee7a2bb..a7f6e0a8f15 100644 --- a/src/test/stdtest/uv.rs +++ b/src/test/stdtest/uv.rs @@ -1,6 +1,7 @@ #[cfg(target_os = "linux")]; #[cfg(target_os = "macos")]; +#[cfg(target_os = "freebsd")]; import core::*; @@ -44,4 +45,4 @@ mod test_ref { uv::loop_delete(loop); */ } -} \ No newline at end of file +} |
