summaryrefslogtreecommitdiff
path: root/src/pkg/go/printer
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
committerOndřej Surý <ondrej@sury.org>2011-04-20 15:44:41 +0200
commit50104cc32a498f7517a51c8dc93106c51c7a54b4 (patch)
tree47af80be259cc7c45d0eaec7d42e61fa38c8e4fb /src/pkg/go/printer
parentc072558b90f1bbedc2022b0f30c8b1ac4712538e (diff)
downloadgolang-upstream/2011.03.07.1.tar.gz
Imported Upstream version 2011.03.07.1upstream/2011.03.07.1
Diffstat (limited to 'src/pkg/go/printer')
-rw-r--r--src/pkg/go/printer/printer.go4
-rw-r--r--src/pkg/go/printer/printer_test.go6
-rw-r--r--src/pkg/go/printer/testdata/statements.golden10
-rw-r--r--src/pkg/go/printer/testdata/statements.input10
4 files changed, 15 insertions, 15 deletions
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index 48e2af1b7..90d9784ac 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -12,7 +12,7 @@ import (
"go/token"
"io"
"os"
- "path"
+ "path/filepath"
"runtime"
"tabwriter"
)
@@ -244,7 +244,7 @@ func (p *printer) writeItem(pos token.Position, data []byte) {
}
if debug {
// do not update p.pos - use write0
- _, filename := path.Split(pos.Filename)
+ _, filename := filepath.Split(pos.Filename)
p.write0([]byte(fmt.Sprintf("[%s:%d:%d]", filename, pos.Line, pos.Column)))
}
p.write(data)
diff --git a/src/pkg/go/printer/printer_test.go b/src/pkg/go/printer/printer_test.go
index 565075aa2..62b726913 100644
--- a/src/pkg/go/printer/printer_test.go
+++ b/src/pkg/go/printer/printer_test.go
@@ -11,7 +11,7 @@ import (
"go/ast"
"go/parser"
"go/token"
- "path"
+ "path/filepath"
"testing"
)
@@ -129,8 +129,8 @@ var data = []entry{
func TestFiles(t *testing.T) {
for _, e := range data {
- source := path.Join(dataDir, e.source)
- golden := path.Join(dataDir, e.golden)
+ source := filepath.Join(dataDir, e.source)
+ golden := filepath.Join(dataDir, e.golden)
check(t, source, golden, e.mode)
// TODO(gri) check that golden is idempotent
//check(t, golden, golden, e.mode);
diff --git a/src/pkg/go/printer/testdata/statements.golden b/src/pkg/go/printer/testdata/statements.golden
index 5eceb7dd5..290060269 100644
--- a/src/pkg/go/printer/testdata/statements.golden
+++ b/src/pkg/go/printer/testdata/statements.golden
@@ -10,9 +10,9 @@ func use(x interface{}) {}
// Formatting of if-statement headers.
func _() {
- if {
+ if true {
}
- if {
+ if true {
} // no semicolon printed
if expr {
}
@@ -22,7 +22,7 @@ func _() {
} // no parens printed
if expr {
} // no semicolon and parens printed
- if x := expr; {
+ if x := expr; true {
use(x)
}
if x := expr; expr {
@@ -354,14 +354,14 @@ func _() {
func _() {
- if {
+ if true {
_ = 0
}
_ = 0 // the indentation here should not be affected by the long label name
AnOverlongLabel:
_ = 0
- if {
+ if true {
_ = 0
}
_ = 0
diff --git a/src/pkg/go/printer/testdata/statements.input b/src/pkg/go/printer/testdata/statements.input
index 7819820ed..21e61efc4 100644
--- a/src/pkg/go/printer/testdata/statements.input
+++ b/src/pkg/go/printer/testdata/statements.input
@@ -10,13 +10,13 @@ func use(x interface{}) {}
// Formatting of if-statement headers.
func _() {
- if {}
- if;{} // no semicolon printed
+ if true {}
+ if; true {} // no semicolon printed
if expr{}
if;expr{} // no semicolon printed
if (expr){} // no parens printed
if;((expr)){} // no semicolon and parens printed
- if x:=expr;{
+ if x:=expr;true{
use(x)}
if x:=expr; expr {use(x)}
}
@@ -271,14 +271,14 @@ func _() {
func _() {
- if {
+ if true {
_ = 0
}
_ = 0 // the indentation here should not be affected by the long label name
AnOverlongLabel:
_ = 0
- if {
+ if true {
_ = 0
}
_ = 0