Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"strings"
"testing"
"time"
"unsafe"
)

Expand Down Expand Up @@ -259,3 +260,13 @@ func TestCycle(t *testing.T) {
*iv = *i
t.Logf("Example long interface cycle:\n%# v", Formatter(i))
}

func TestTime(t *testing.T) {
date := time.Date(2006, 1, 2, 3, 4, 5, .678901e9, time.Local)
d, _ := date.MarshalText()
s := fmt.Sprintf("%# v", Formatter(date))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could write this as Sprintf("%# v", date).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, I guess all the other ones in this file already use fmt, so might as well be consistent.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't have time to dive into a fix for this right away. Not a pain point for me, but I had the itch to at least reproduce it. Another dev on my team hit it once and also didn't provide steps to reproduce, so I had to scratch that itch.

On Sep 29, 2014, at 22:04, Keith Rarick notifications@github.com wrote:

In formatter_test.go:

@@ -259,3 +260,13 @@ func TestCycle(t *testing.T) {
*iv = *i
t.Logf("Example long interface cycle:\n%# v", Formatter(i))
}
+
+func TestTime(t *testing.T) {

  • date := time.Date(2006, 1, 2, 3, 4, 5, .678901e9, time.Local)
  • d, _ := date.MarshalText()
  • s := fmt.Sprintf("%# v", Formatter(date))
    I guess all the other ones in this file already use fmt, so might as well be consistent.


Reply to this email directly or view it on GitHub.


if s != string(d) {
t.Errorf("expected %s, got %s", string(d), s)
}
}