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 Nov 29, 2023
1 parent 0a4936f commit 6826e47
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 @@ -82,6 +82,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 @@ -244,6 +245,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 @@ -531,6 +533,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 @@ -662,6 +665,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 6826e47

Please sign in to comment.