Add some comments for magic numbers + Add tests

This commit is contained in:
Vadim Petrochenkov 2020-08-05 00:26:23 +03:00
parent 6b25c50ed4
commit a7eabec1df
5 changed files with 84 additions and 1 deletions

View file

@ -0,0 +1,24 @@
// check-pass
// aux-build:test-macros.rs
// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
#[macro_use]
extern crate test_macros;
print_bang! {
/**
*******
* DOC *
* DOC *
* DOC *
*******
*/
pub struct S;
}
fn main() {}

View file

@ -0,0 +1,54 @@
PRINT-BANG INPUT (DISPLAY): /**
*******
* DOC *
* DOC *
* DOC *
*******
*/
pub struct S ;
PRINT-BANG RE-COLLECTED (DISPLAY): #[doc = "\n*******\n* DOC *\n* DOC *\n* DOC *\n*******\n"] pub struct S ;
PRINT-BANG INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
span: #0 bytes(LO..HI),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "doc",
span: #0 bytes(LO..HI),
},
Punct {
ch: '=',
spacing: Alone,
span: #0 bytes(LO..HI),
},
Literal {
kind: Str,
symbol: "\n*******\n* DOC *\n* DOC *\n* DOC *\n*******\n",
suffix: None,
span: #0 bytes(LO..HI),
},
],
span: #0 bytes(LO..HI),
},
Ident {
ident: "pub",
span: #0 bytes(LO..HI),
},
Ident {
ident: "struct",
span: #0 bytes(LO..HI),
},
Ident {
ident: "S",
span: #0 bytes(LO..HI),
},
Punct {
ch: ';',
spacing: Alone,
span: #0 bytes(LO..HI),
},
]