diff options
author | Martin Fischer <martin@push-f.com> | 2021-04-08 15:46:24 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-04-08 15:57:18 +0200 |
commit | eb0e8506472f2d672b00227bb07089c313484945 (patch) | |
tree | 01e7d8ee398940515952830a1177e497c561f937 /src/util | |
parent | 18a022579737acc599277258fc4a8472ba73a8b0 (diff) |
stop exporting macros
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/str.rs | 11 |
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); |