(t *testing.T)
| 20 | ) |
| 21 | |
| 22 | func TestFormatter(t *testing.T) { |
| 23 | for i, tc := range []struct { |
| 24 | description string |
| 25 | input string |
| 26 | expect string |
| 27 | }{ |
| 28 | { |
| 29 | description: "very simple", |
| 30 | input: `abc def |
| 31 | g hi jkl |
| 32 | mn`, |
| 33 | expect: `abc def |
| 34 | g hi jkl |
| 35 | mn`, |
| 36 | }, |
| 37 | { |
| 38 | description: "basic indentation, line breaks, and nesting", |
| 39 | input: ` a |
| 40 | b |
| 41 | |
| 42 | c { |
| 43 | d |
| 44 | } |
| 45 | |
| 46 | e { f |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | g { |
| 52 | h { |
| 53 | i |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | j { k { |
| 58 | l |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | m { |
| 63 | n { o |
| 64 | } |
| 65 | p { q r |
| 66 | s } |
| 67 | } |
| 68 | |
| 69 | { |
| 70 | { t |
| 71 | u |
| 72 | |
| 73 | v |
| 74 | |
| 75 | w |
| 76 | } |
| 77 | }`, |
| 78 | expect: `a |
| 79 | b |