Skip to content

Commit

Permalink
Add a few cases with wonky formatting to stringify.rs test.
Browse files Browse the repository at this point in the history
Because the spacing-based pretty-printing partially preserves that.
  • Loading branch information
nnethercote committed Dec 10, 2023
1 parent 4cfdbd3 commit 940c885
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/ui/macros/stringify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fn test_expr() {
// ExprKind::Call
c1!(expr, [ f() ], "f()");
c1!(expr, [ f::<u8>() ], "f::<u8>()");
c2!(expr, [ f :: < u8>( ) ], "f::<u8>()", "f :: < u8>()");
c1!(expr, [ f::<1>() ], "f::<1>()");
c1!(expr, [ f::<'a, u8, 1>() ], "f::<'a, u8, 1>()");
c1!(expr, [ f(true) ], "f(true)");
Expand Down Expand Up @@ -245,6 +246,7 @@ fn test_expr() {
c1!(expr, [ ..hi ], "..hi");
c1!(expr, [ lo.. ], "lo..");
c1!(expr, [ lo..hi ], "lo..hi");
c2!(expr, [ lo .. hi ], "lo..hi", "lo .. hi");
c1!(expr, [ ..=hi ], "..=hi");
c1!(expr, [ lo..=hi ], "lo..=hi");
c1!(expr, [ -2..=-1 ], "-2..=-1");
Expand Down Expand Up @@ -532,6 +534,7 @@ fn test_pat() {
// PatKind::Struct
c1!(pat, [ Struct {} ], "Struct {}");
c1!(pat, [ Struct::<u8> {} ], "Struct::<u8> {}");
c2!(pat, [ Struct ::< u8 > {} ], "Struct::<u8> {}", "Struct ::< u8 > {}");
c1!(pat, [ Struct::<'static> {} ], "Struct::<'static> {}");
c1!(pat, [ Struct { x } ], "Struct { x }");
c1!(pat, [ Struct { x: _x } ], "Struct { x: _x }");
Expand Down Expand Up @@ -667,6 +670,7 @@ fn test_ty() {
c1!(ty, [ &'a T ], "&'a T");
c1!(ty, [ &'a mut [T] ], "&'a mut [T]");
c1!(ty, [ &A<B<C<D<E>>>> ], "&A<B<C<D<E>>>>");
c2!(ty, [ &A<B<C<D<E> > > > ], "&A<B<C<D<E>>>>", "&A<B<C<D<E> > > >");

// TyKind::BareFn
c1!(ty, [ fn() ], "fn()");
Expand Down

0 comments on commit 940c885

Please sign in to comment.