Skip to content

Commit

Permalink
Merge a9f25ca into ed1f1c1
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Oct 25, 2016
2 parents ed1f1c1 + a9f25ca commit d5d4e14
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions fmts/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions fmts/fmt_test.go
Expand Up @@ -25,13 +25,6 @@ func testfmt(t *testing.T, name string, f *Fmt) {
return
}
defer in.Close()
okfile := fmt.Sprintf("testdata/%s.ok", name)
ok, err := os.Open(okfile)
if err != nil {
t.Errorf("no ok test for %q: %v", name, err)
return
}
defer ok.Close()
outfile := fmt.Sprintf("testdata/%s.out", name)
out, err := os.Create(outfile)
if err != nil {
Expand All @@ -51,6 +44,13 @@ func testfmt(t *testing.T, name string, f *Fmt) {
if err := bufout.Flush(); err != nil {
t.Error(err)
}
okfile := fmt.Sprintf("testdata/%s.ok", name)
ok, err := os.Open(okfile)
if err != nil {
t.Errorf("no ok test for %q: %v", name, err)
return
}
defer ok.Close()
b, err := exec.Command("diff", "-u", okfile, outfile).Output()
if err != nil {
t.Error(err)
Expand Down
7 changes: 7 additions & 0 deletions fmts/gendoc.go
Expand Up @@ -26,6 +26,9 @@ func run() error {
defer f.Close()
w := bufio.NewWriter(f)
defer w.Flush()

fmt.Fprintln(w, firstlines)
fmt.Fprintln(w, "")
fmt.Fprintln(w, pkgcomment)
fmt.Fprintln(w, "//")
fmt.Fprintln(w, "// Defined formats:")
Expand Down Expand Up @@ -58,6 +61,10 @@ func run() error {
}

const (
firstlines = `// Code generated by 'go generate'
// source: fmts/gendoc.go
// DO NOT EDIT!
// Please run '$ go generate ./...' instead to update this file`
pkgcomment = `// Package fmts holds defined errorformats.`
pkgline = `package fmts`
)

0 comments on commit d5d4e14

Please sign in to comment.