Skip to content

Commit 5a7c61f

Browse files
author
Thomas Bahn
committed
Fix the tests when running without std
1 parent 7ca810c commit 5a7c61f

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ documentation = "https://tomprogrammer.github.io/rust-ascii/ascii/index.html"
55
license = "Apache-2.0 / MIT"
66
name = "ascii"
77
repository = "https://github.com/tomprogrammer/rust-ascii"
8-
version = "0.8.3"
8+
version = "0.8.4"
99

1010
[dependencies.quickcheck]
1111
optional = true

RELEASES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 0.8.4 (2017-04-18)
2+
==========================
3+
* Fix the tests when running without std.
4+
15
Version 0.8.3 (2017-04-18)
26
==========================
37
* Bugfix: `<AsciiStr as AsciiExt>::to_ascii_lowercase` did erroneously convert to uppercase.

src/ascii_str.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -695,20 +695,28 @@ mod tests {
695695
}
696696

697697
#[test]
698-
fn ascii_case() {
698+
fn make_ascii_case() {
699699
let mut bytes = ([b'a',b'@',b'A'], [b'A',b'@',b'a']);
700700
let mut a = bytes.0.as_mut_ascii_str().unwrap();
701701
let mut b = bytes.1.as_mut_ascii_str().unwrap();
702702
assert!(a.eq_ignore_ascii_case(b));
703703
assert!(b.eq_ignore_ascii_case(a));
704-
assert_eq!(a.to_ascii_lowercase().as_str(), "a@a");
705-
assert_eq!(a.to_ascii_uppercase().as_str(), "A@A");
706704
a.make_ascii_lowercase();
707705
b.make_ascii_uppercase();
708706
assert_eq!(a, "a@a");
709707
assert_eq!(b, "A@A");
710708
}
711709

710+
#[test]
711+
#[cfg(features = "std")]
712+
fn to_ascii_case() {
713+
let mut bytes = ([b'a',b'@',b'A'], [b'A',b'@',b'a']);
714+
let mut a = bytes.0.as_mut_ascii_str().unwrap();
715+
let mut b = bytes.1.as_mut_ascii_str().unwrap();
716+
assert_eq!(a.to_ascii_lowercase().as_str(), "a@a");
717+
assert_eq!(a.to_ascii_uppercase().as_str(), "A@A");
718+
}
719+
712720
#[test]
713721
fn chars_iter() {
714722
let chars = &[b'h', b'e', b'l', b'l', b'o', b' ', b'w', b'o', b'r', b'l', b'd', b'\0'];

0 commit comments

Comments
 (0)