aboutsummaryrefslogtreecommitdiff
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
parent443b81192a3334af2ba82214bc38c60f21fc6e7c (diff)
downloadpaste-69b99531aae988863d98e52cfbc0684e83437cdc.tar.gz
Upgrade rust/crates/paste to 0.1.11
Test: None Change-Id: Ibde2e25e0a141f60e50cd35d27f010a5133a7d45
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig4
-rw-r--r--METADATA4
-rw-r--r--src/lib.rs5
-rw-r--r--tests/test.rs30
6 files changed, 40 insertions, 9 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 28d7b30..652f708 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "5feb37605c9ec2d237651dbd669e3527566a839e"
+ "sha1": "a3c7d4f0d396480243fd40b777bd3708e87ea80c"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index f9d3ead..c3f415c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "paste"
-version = "0.1.10"
+version = "0.1.11"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Macros for all your token pasting needs"
readme = "README.md"
@@ -22,7 +22,7 @@ repository = "https://github.com/dtolnay/paste"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies.paste-impl]
-version = "=0.1.10"
+version = "=0.1.11"
[dependencies.proc-macro-hack]
version = "0.5.9"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 6f0d704..285cd55 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "paste"
-version = "0.1.10"
+version = "0.1.11"
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
@@ -12,7 +12,7 @@ readme = "README.md"
travis-ci = { repository = "dtolnay/paste" }
[dependencies]
-paste-impl = { version = "=0.1.10", path = "impl" }
+paste-impl = { version = "=0.1.11", path = "impl" }
proc-macro-hack = "0.5.9"
[dev-dependencies]
diff --git a/METADATA b/METADATA
index bf81f11..14dab27 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
type: GIT
value: "https://github.com/dtolnay/paste"
}
- version: "0.1.10"
+ version: "0.1.11"
license_type: NOTICE
last_upgrade_date {
year: 2020
month: 4
- day: 17
+ day: 27
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 8125222..6d73ee3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -117,8 +117,9 @@
//! example, `[<ld_ $reg:lower _expr>]` would paste to `ld_bc_expr` if invoked
//! with $reg=`Bc`.
//!
-//! Use `$var:snake` to convert CamelCase input to snake\_case. These compose,
-//! so for example `$var:snake:upper` would give you SCREAMING\_CASE.
+//! Use `$var:snake` to convert CamelCase input to snake\_case.
+//! Use `$var:camel` to convert snake\_case to CamelCase.
+//! These compose, so for example `$var:snake:upper` would give you SCREAMING\_CASE.
//!
//! The precise Unicode conversions are as defined by [`str::to_lowercase`] and
//! [`str::to_uppercase`].
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;
+ }
+}