Skip to content

Commit

Permalink
Normalize the test output of hygiene-related tests
Browse files Browse the repository at this point in the history
A raw SyntaxContext id is implicitly dependent on the target platform,
since libstd and libcore have platform-dependent #[cfg]s which affect
which macros are invoked. As a result, we must strip out any
SyntaxContext ids from test output to ensure that the captured stdout is
not platform-dependent.
  • Loading branch information
Aaron1011 committed Jul 27, 2020
1 parent 768803c commit f7235a8
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 194 deletions.
1 change: 1 addition & 0 deletions src/test/ui/proc-macro/dollar-crate-issue-57089.rs
Expand Up @@ -5,6 +5,7 @@
// 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)"
// normalize-stdout-test "#\d+" -> "#CTXT"

#[macro_use]
extern crate test_macros;
Expand Down
32 changes: 16 additions & 16 deletions src/test/ui/proc-macro/dollar-crate-issue-57089.stdout
Expand Up @@ -2,79 +2,79 @@ PRINT-BANG INPUT (DISPLAY): struct M($crate :: S) ;
PRINT-BANG INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "M",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Joint,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "S",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ';',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
]
PRINT-ATTR INPUT (DISPLAY): struct A($crate :: S) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "A",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Joint,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "S",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ';',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
]
1 change: 1 addition & 0 deletions src/test/ui/proc-macro/dollar-crate-issue-62325.rs
Expand Up @@ -6,6 +6,7 @@
// 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)"
// normalize-stdout-test "#\d+" -> "#CTXT"

#[macro_use]
extern crate test_macros;
Expand Down
44 changes: 22 additions & 22 deletions src/test/ui/proc-macro/dollar-crate-issue-62325.stdout
Expand Up @@ -2,109 +2,109 @@ PRINT-ATTR INPUT (DISPLAY): struct A(identity ! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "A",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "identity",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: '!',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Joint,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "S",
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ';',
spacing: Alone,
span: #6 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
]
PRINT-ATTR INPUT (DISPLAY): struct B(identity ! ($crate :: S)) ;
PRINT-ATTR INPUT (DEBUG): TokenStream [
Ident {
ident: "struct",
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "B",
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "identity",
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: '!',
spacing: Alone,
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "$crate",
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Joint,
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ':',
spacing: Alone,
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Ident {
ident: "S",
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
],
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
Punct {
ch: ';',
spacing: Alone,
span: #13 bytes(LO..HI),
span: #CTXT bytes(LO..HI),
},
]
1 change: 1 addition & 0 deletions src/test/ui/proc-macro/dollar-crate.rs
Expand Up @@ -6,6 +6,7 @@
// 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)"
// normalize-stdout-test "#\d+" -> "#CTXT"

#[macro_use]
extern crate test_macros;
Expand Down

0 comments on commit f7235a8

Please sign in to comment.