aboutsummaryrefslogtreecommitdiff
path: root/src/util/str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/str.rs')
-rw-r--r--src/util/str.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/str.rs b/src/util/str.rs
index 84604bc..c3185a0 100644
--- a/src/util/str.rs
+++ b/src/util/str.rs
@@ -27,6 +27,17 @@ pub fn is_ascii_alnum(c: char) -> bool {
mod test {
use super::{is_ascii_alnum, lower_ascii_letter};
+ /// Generate a test function `$name` which asserts that `$left` and `$right`
+ /// are equal.
+ macro_rules! test_eq {
+ ($name:ident, $left:expr, $right:expr) => {
+ #[test]
+ fn $name() {
+ assert_eq!($left, $right);
+ }
+ }
+ }
+
test_eq!(lower_letter_a_is_a, lower_ascii_letter('a'), Some('a'));
test_eq!(lower_letter_A_is_a, lower_ascii_letter('A'), Some('a'));
test_eq!(lower_letter_symbol_is_None, lower_ascii_letter('!'), None);