Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
std::ascii: Add tests for is_digit() and is_control()
  • Loading branch information
ebiggers committed Nov 27, 2013
1 parent 7b96f13 commit 6488324
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libstd/ascii.rs
Expand Up @@ -498,6 +498,15 @@ mod tests {
assert_eq!('`'.to_ascii().to_upper().to_char(), '`');
assert_eq!('{'.to_ascii().to_upper().to_char(), '{');

assert!('0'.to_ascii().is_digit());
assert!('9'.to_ascii().is_digit());
assert!(!'/'.to_ascii().is_digit());
assert!(!':'.to_ascii().is_digit());

assert!((0x1fu8).to_ascii().is_control());
assert!(!' '.to_ascii().is_control());
assert!((0x7fu8).to_ascii().is_control());

assert!("banana".chars().all(|c| c.is_ascii()));
assert!(!"ประเทศไทย中华Việt Nam".chars().all(|c| c.is_ascii()));
}
Expand Down

5 comments on commit 6488324

@bors
Copy link
Contributor

@bors bors commented on 6488324 Nov 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 6488324 Nov 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging ebiggers/rust/ascii_fixes = 6488324 into auto

@bors
Copy link
Contributor

@bors bors commented on 6488324 Nov 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ebiggers/rust/ascii_fixes = 6488324 merged ok, testing candidate = e147a09

@bors
Copy link
Contributor

@bors bors commented on 6488324 Nov 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 6488324 Nov 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e147a09

Please sign in to comment.