aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-04-27 13:16:43 -0700
committerHaibo Huang <hhb@google.com>2020-04-27 13:16:43 -0700
commit69b99531aae988863d98e52cfbc0684e83437cdc (patch)
tree148c8cf369134868420f481a91ede93274ca06da /tests
parent443b81192a3334af2ba82214bc38c60f21fc6e7c (diff)
downloadpaste-69b99531aae988863d98e52cfbc0684e83437cdc.tar.gz
Upgrade rust/crates/paste to 0.1.11
Test: None Change-Id: Ibde2e25e0a141f60e50cd35d27f010a5133a7d45
Diffstat (limited to 'tests')
-rw-r--r--tests/test.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test.rs b/tests/test.rs
index 435eb71..e281c92 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -255,3 +255,33 @@ fn test_env_to_snake() {
let _ = LIBPASTE;
}
}
+
+mod test_to_camel {
+ macro_rules! m {
+ ($id:ident) => {
+ paste::item! {
+ const DEFAULT_CAMEL: &str = stringify!([<$id:camel>]);
+ const LOWER_CAMEL: &str = stringify!([<$id:camel:lower>]);
+ const UPPER_CAMEL: &str = stringify!([<$id:camel:upper>]);
+ }
+ };
+ }
+
+ m!(this_is_but_a_test);
+
+ #[test]
+ fn test_to_camel() {
+ assert_eq!(DEFAULT_CAMEL, "ThisIsButATest");
+ assert_eq!(LOWER_CAMEL, "thisisbutatest");
+ assert_eq!(UPPER_CAMEL, "THISISBUTATEST");
+ }
+}
+
+#[test]
+fn test_env_to_camel() {
+ paste::expr! {
+ const [<LIB env!("CARGO_PKG_NAME"):camel>]: &str = "libpaste";
+
+ let _ = LIBPaste;
+ }
+}