| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package formatter | 5 package formatter |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "strings" | 8 "strings" |
| 9 "testing" | 9 "testing" |
| 10 ) | 10 ) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 actual, err := FormatMojom("test.mojom", original) | 103 actual, err := FormatMojom("test.mojom", original) |
| 104 if err != nil { | 104 if err != nil { |
| 105 t.Fatalf("Parser was not supposed to fail: %s", err.Error()) | 105 t.Fatalf("Parser was not supposed to fail: %s", err.Error()) |
| 106 } | 106 } |
| 107 | 107 |
| 108 if original != actual { | 108 if original != actual { |
| 109 t.Fatalf("\nExpected:\n%v\n\n*****\n\nActual:\n%v eof", original
, actual) | 109 t.Fatalf("\nExpected:\n%v\n\n*****\n\nActual:\n%v eof", original
, actual) |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 |
| 113 func TestFormatNoExtraFinalBlankLine(t *testing.T) { |
| 114 original := `interface ImagePipe { |
| 115 // Some comment. |
| 116 FlushImages(); |
| 117 |
| 118 }; |
| 119 ` |
| 120 |
| 121 expected := `interface ImagePipe { |
| 122 // Some comment. |
| 123 FlushImages(); |
| 124 }; |
| 125 ` |
| 126 actual, err := FormatMojom("test.mojom", original) |
| 127 if err != nil { |
| 128 t.Fatalf("Parser was not supposed to fail: %s", err.Error()) |
| 129 } |
| 130 |
| 131 if expected != actual { |
| 132 t.Fatalf("\nExpected:\n%v\n\n*****\n\nActual:\n%v eof", expected
, actual) |
| 133 } |
| 134 } |
| OLD | NEW |