diff options
| author | David Tolnay <dtolnay@gmail.com> | 2021-04-29 11:17:44 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2021-05-19 11:38:23 -0700 |
| commit | 3c16c0e1df61755db2267897392529eb9451aa62 (patch) | |
| tree | 9ab609c5c44a85b2092ad3176cb380f60ca7095f /src | |
| parent | 39441bb2c1030884d0f1d200de0a65b146ba6b6d (diff) | |
Move proc_macro tests to ui test
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/proc-macro/auxiliary/api/cmp.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/auxiliary/api/mod.rs | 4 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/auxiliary/api/cmp.rs b/src/test/ui/proc-macro/auxiliary/api/cmp.rs new file mode 100644 index 00000000000..3d17e9e350e --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/api/cmp.rs @@ -0,0 +1,21 @@ +use proc_macro::{LineColumn, Punct}; + +pub fn test() { + test_line_column_ord(); + test_punct_eq(); +} + +fn test_line_column_ord() { + let line0_column0 = LineColumn { line: 0, column: 0 }; + let line0_column1 = LineColumn { line: 0, column: 1 }; + let line1_column0 = LineColumn { line: 1, column: 0 }; + assert!(line0_column0 < line0_column1); + assert!(line0_column1 < line1_column0); +} + +fn test_punct_eq() { + // Good enough if it typechecks, since proc_macro::Punct can't exist in a test. + fn _check(punct: Punct) { + let _ = punct == ':'; + } +} diff --git a/src/test/ui/proc-macro/auxiliary/api/mod.rs b/src/test/ui/proc-macro/auxiliary/api/mod.rs index 72b02ad554e..019fb2e7ec8 100644 --- a/src/test/ui/proc-macro/auxiliary/api/mod.rs +++ b/src/test/ui/proc-macro/auxiliary/api/mod.rs @@ -3,14 +3,18 @@ #![crate_type = "proc-macro"] #![crate_name = "proc_macro_api_tests"] +#![feature(proc_macro_span)] #![deny(dead_code)] // catch if a test function is never called extern crate proc_macro; +mod cmp; + use proc_macro::TokenStream; #[proc_macro] pub fn run(input: TokenStream) -> TokenStream { assert!(input.is_empty()); + cmp::test(); TokenStream::new() } |
