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

Unified Diff: mojom/mojom_parser/formatter/printer_test.go

Issue 1819203002: Fix some issues with whitespace in formatter. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/mojom_parser/formatter/printer.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/formatter/printer_test.go
diff --git a/mojom/mojom_parser/formatter/printer_test.go b/mojom/mojom_parser/formatter/printer_test.go
index 6014009214157408f329ccbf7c03e7bfbe79215b..2e2888aff398d6d0a6216caf21938b0343e720ed 100644
--- a/mojom/mojom_parser/formatter/printer_test.go
+++ b/mojom/mojom_parser/formatter/printer_test.go
@@ -140,6 +140,22 @@ import "foo2.mojom";
checkEq(t, expected, p.result())
}
+func TestWriteSingleLineComment(t *testing.T) {
+ commentText := "// Hello world."
+ token := lexer.Token{Kind: lexer.SingleLineComment, Text: commentText}
+ p := getNewPrinter()
+ p.writeSingleLineComment(token)
+ checkEq(t, commentText, p.result())
+}
+
+func TestWriteSingleLineCommentAddSpace(t *testing.T) {
+ commentText := "//Hello world."
+ token := lexer.Token{Kind: lexer.SingleLineComment, Text: commentText}
+ p := getNewPrinter()
+ p.writeSingleLineComment(token)
+ checkEq(t, "// Hello world.", p.result())
+}
+
func TestWriteMultilineComments(t *testing.T) {
commentText := `/*
* Some comment.
« no previous file with comments | « mojom/mojom_parser/formatter/printer.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698