From 69b99531aae988863d98e52cfbc0684e83437cdc Mon Sep 17 00:00:00 2001 From: Haibo Huang Date: Mon, 27 Apr 2020 13:16:43 -0700 Subject: Upgrade rust/crates/paste to 0.1.11 Test: None Change-Id: Ibde2e25e0a141f60e50cd35d27f010a5133a7d45 --- tests/test.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests') 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 []: &str = "libpaste"; + + let _ = LIBPaste; + } +} -- cgit v1.2.3