Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: mojom/mojom_parser/formatter/formatter_test.go

Issue 1829893002: Formatter: Avoid extraneous empty lines at the end of a block. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/mojom_tool/bin/mac64/mojom.sha1 ('k') | mojom/mojom_parser/formatter/printer.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698