about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2019-09-07 10:53:34 +0700
committerLzu Tao <taolzu@gmail.com>2019-09-09 16:14:32 +0700
commitca1c0aa8196c439b385f6038b5bb52924c4808f9 (patch)
tree2fb8e161ef970158e0b49e2290278064ab652298
parenta5f4d3ce294f24d825080f48507ccdcce3d3e1fb (diff)
downloadrust-ca1c0aa8196c439b385f6038b5bb52924c4808f9.tar.gz
rust-ca1c0aa8196c439b385f6038b5bb52924c4808f9.zip
Add a regression test for proc-macro attribute
-rw-r--r--mini-macro/src/lib.rs3
-rw-r--r--tests/ui/unseparated_prefix_literals.fixed7
-rw-r--r--tests/ui/unseparated_prefix_literals.rs7
-rw-r--r--tests/ui/unseparated_prefix_literals.stderr18
4 files changed, 26 insertions, 9 deletions
diff --git a/mini-macro/src/lib.rs b/mini-macro/src/lib.rs
index ddb40dace75..60ffd94e733 100644
--- a/mini-macro/src/lib.rs
+++ b/mini-macro/src/lib.rs
@@ -17,5 +17,8 @@ pub fn mini_macro(_: TokenStream) -> TokenStream {
                 println!("{}", items[i]);
             }
         }
+        fn line_wrapper() {
+            println!("{}", line!());
+        }
     )
 }
diff --git a/tests/ui/unseparated_prefix_literals.fixed b/tests/ui/unseparated_prefix_literals.fixed
index 26bc47257b7..3c422cc4fee 100644
--- a/tests/ui/unseparated_prefix_literals.fixed
+++ b/tests/ui/unseparated_prefix_literals.fixed
@@ -3,6 +3,13 @@
 #![warn(clippy::unseparated_literal_suffix)]
 #![allow(dead_code)]
 
+#[macro_use]
+extern crate clippy_mini_macro_test;
+
+// Test for proc-macro attribute
+#[derive(ClippyMiniMacroTest)]
+struct Foo;
+
 macro_rules! lit_from_macro {
     () => {
         42_usize
diff --git a/tests/ui/unseparated_prefix_literals.rs b/tests/ui/unseparated_prefix_literals.rs
index d710ccd1be2..09608661e0e 100644
--- a/tests/ui/unseparated_prefix_literals.rs
+++ b/tests/ui/unseparated_prefix_literals.rs
@@ -3,6 +3,13 @@
 #![warn(clippy::unseparated_literal_suffix)]
 #![allow(dead_code)]
 
+#[macro_use]
+extern crate clippy_mini_macro_test;
+
+// Test for proc-macro attribute
+#[derive(ClippyMiniMacroTest)]
+struct Foo;
+
 macro_rules! lit_from_macro {
     () => {
         42usize
diff --git a/tests/ui/unseparated_prefix_literals.stderr b/tests/ui/unseparated_prefix_literals.stderr
index 85f1881949e..d353d34fb35 100644
--- a/tests/ui/unseparated_prefix_literals.stderr
+++ b/tests/ui/unseparated_prefix_literals.stderr
@@ -1,5 +1,5 @@
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:16:18
+  --> $DIR/unseparated_prefix_literals.rs:23:18
    |
 LL |     let _fail1 = 1234i32;
    |                  ^^^^^^^ help: add an underscore: `1234_i32`
@@ -7,43 +7,43 @@ LL |     let _fail1 = 1234i32;
    = note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:17:18
+  --> $DIR/unseparated_prefix_literals.rs:24:18
    |
 LL |     let _fail2 = 1234u32;
    |                  ^^^^^^^ help: add an underscore: `1234_u32`
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:18:18
+  --> $DIR/unseparated_prefix_literals.rs:25:18
    |
 LL |     let _fail3 = 1234isize;
    |                  ^^^^^^^^^ help: add an underscore: `1234_isize`
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:19:18
+  --> $DIR/unseparated_prefix_literals.rs:26:18
    |
 LL |     let _fail4 = 1234usize;
    |                  ^^^^^^^^^ help: add an underscore: `1234_usize`
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:20:18
+  --> $DIR/unseparated_prefix_literals.rs:27:18
    |
 LL |     let _fail5 = 0x123isize;
    |                  ^^^^^^^^^^ help: add an underscore: `0x123_isize`
 
 error: float type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:24:19
+  --> $DIR/unseparated_prefix_literals.rs:31:19
    |
 LL |     let _failf1 = 1.5f32;
    |                   ^^^^^^ help: add an underscore: `1.5_f32`
 
 error: float type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:25:19
+  --> $DIR/unseparated_prefix_literals.rs:32:19
    |
 LL |     let _failf2 = 1f32;
    |                   ^^^^ help: add an underscore: `1_f32`
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:8:9
+  --> $DIR/unseparated_prefix_literals.rs:15:9
    |
 LL |         42usize
    |         ^^^^^^^ help: add an underscore: `42_usize`
@@ -52,7 +52,7 @@ LL |     let _ = lit_from_macro!();
    |             ----------------- in this macro invocation
 
 error: integer type suffix should be separated by an underscore
-  --> $DIR/unseparated_prefix_literals.rs:33:16
+  --> $DIR/unseparated_prefix_literals.rs:40:16
    |
 LL |     assert_eq!(4897u32, 32223);
    |                ^^^^^^^ help: add an underscore: `4897_u32`