Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(98)

Delta Between Two Patch Sets: src/go/format/format_test.go

Issue 142360043: code review 142360043: go/format, cmd/gofmt: fix issues with partial Go code w... (Closed)
Left Patch Set: diff -r 932fe22207465e6c4bcdae29f5c519ba069f8927 https://code.google.com/p/go Created 9 years, 6 months ago
Right Patch Set: diff -r 8f36a32a9d036f86fb956c8538142eb384bd1a4a https://code.google.com/p/go Created 9 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/go/format/format.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package format 5 package format
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "go/parser" 9 "go/parser"
10 "go/token" 10 "go/token"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 // statement lists 81 // statement lists
82 "x := 0", 82 "x := 0",
83 "f(a, b, c)\nvar x int = f(1, 2, 3)", 83 "f(a, b, c)\nvar x int = f(1, 2, 3)",
84 84
85 // indentation, leading and trailing space 85 // indentation, leading and trailing space
86 "\tx := 0\n\tgo f()", 86 "\tx := 0\n\tgo f()",
87 "\tx := 0\n\tgo f()\n\n\n", 87 "\tx := 0\n\tgo f()\n\n\n",
88 "\n\t\t\n\n\tx := 0\n\tgo f()\n\n\n", 88 "\n\t\t\n\n\tx := 0\n\tgo f()\n\n\n",
89 "\n\t\t\n\n\t\t\tx := 0\n\t\t\tgo f()\n\n\n", 89 "\n\t\t\n\n\t\t\tx := 0\n\t\t\tgo f()\n\n\n",
90 » "\n\t\t\n\n\t\t\tx := 0\n\t\t\tconst s = `\nfoo\n`\n\n\n", // no indenta tion inside raw strings 90 » "\n\t\t\n\n\t\t\tx := 0\n\t\t\tconst s = `\nfoo\n`\n\n\n", // no ind entation added inside raw strings
91 » "\n\t\t\n\n\t\t\tx := 0\n\t\t\tconst s = `\n\t\tfoo\n`\n\n\n", // no ind entation removed inside raw strings
91 92
92 // comments 93 // comments
93 "i := 5 /* Comment */", // Issue 5551. 94 "i := 5 /* Comment */", // Issue 5551.
94 95
95 // erroneous programs 96 // erroneous programs
96 "ERROR1 + 2 +", 97 "ERROR1 + 2 +",
97 "ERRORx := 0", 98 "ERRORx := 0",
98 } 99 }
99 100
100 func String(s string) (string, error) { 101 func String(s string) (string, error) {
(...skipping 17 matching lines...) Expand all
118 // test expected to succeed 119 // test expected to succeed
119 res, err := String(src) 120 res, err := String(src)
120 if err != nil { 121 if err != nil {
121 t.Errorf("formatting failed (%s):\n%q", err, src ) 122 t.Errorf("formatting failed (%s):\n%q", err, src )
122 } else if res != src { 123 } else if res != src {
123 t.Errorf("formatting incorrect:\nsource: %q\nres ult: %q", src, res) 124 t.Errorf("formatting incorrect:\nsource: %q\nres ult: %q", src, res)
124 } 125 }
125 } 126 }
126 } 127 }
127 } 128 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b