Put str tests in a nested tests module

This commit is contained in:
Eryn Wells 2017-04-03 16:55:47 -04:00
parent 104b9b0864
commit 4a0586b1a5

View file

@ -62,8 +62,12 @@ impl CharAt for str {
}
}
#[test]
fn index_before_is_well_behaved_for_ascii() {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn index_before_is_well_behaved_for_ascii() {
let s = "abc";
// Sanity
@ -79,10 +83,10 @@ fn index_before_is_well_behaved_for_ascii() {
assert_eq!(last_char.len(), 1);
assert_eq!(last_char.chars().nth(0), Some('c'));
}
}
}
#[test]
fn index_after_is_well_behaved_for_ascii() {
#[test]
fn index_after_is_well_behaved_for_ascii() {
let s = "abc";
// Sanity
@ -95,4 +99,5 @@ fn index_after_is_well_behaved_for_ascii() {
assert_eq!(idx, s.len());
assert!(s.is_char_boundary(idx));
}
}
}