Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test failed due to double quotes in Date #17

Closed
kiririmode opened this issue May 7, 2018 · 2 comments · Fixed by #18
Closed

make test failed due to double quotes in Date #17

kiririmode opened this issue May 7, 2018 · 2 comments · Fixed by #18
Assignees

Comments

@kiririmode
Copy link
Contributor

make test failed as the followings. Apparently, the cause of errors is double quotes in Date.

$ go version
go version go1.10.1 darwin/amd64

$ make test
go get  -d -t -v ./...
go test ./...
--- FAIL: TestFullContent (0.00s)
        entry_test.go:56:
                        Error Trace:    entry_test.go:56
                        Error:          Not equal:
                                        expected: "---\nTitle: 所内#3\nDate: \"2012-12-19T00:00:00+09:00\"\nURL: http://hatenablog.example.com/1\nEditURL: http://hatenablog.example.com/1/edit\n---\n\ntest\ntest2\n"
                                        actual  : "---\nTitle: 所内#3\nDate: 2012-12-19T00:00:00+09:00\nURL: http://hatenablog.example.com/1\nEditURL: http://hatenablog.example.com/1/edit\n---\n\ntest\ntest2\n"
                        Test:           TestFullContent
--- FAIL: TestDraftFullContent (0.00s)
        entry_test.go:99:
                        Error Trace:    entry_test.go:99
                        Error:          Not equal:
                                        expected: "---\nTitle: 所内#4\nDate: \"2012-12-20T00:00:00+09:00\"\nURL: http://hatenablog.example.com/2\nEditURL: http://hatenablog.example.com/2/edit\nDraft: true\n---\n\n下書き\n"
                                        actual  : "---\nTitle: 所内#4\nDate: 2012-12-20T00:00:00+09:00\nURL: http://hatenablog.example.com/2\nEditURL: http://hatenablog.example.com/2/edit\nDraft: true\n---\n\n下書き\n"
                        Test:           TestDraftFullContent
--- FAIL: TestUnmarshalYAML (0.00s)
        entry_test.go:135:
                        Error Trace:    entry_test.go:135
                        Error:          Not equal:
                                        expected: "Title: 所内\nCategory:\n- foo\n- bar\nDate: 2012-12-20T00:00:00+09:00\nURL: http://hatenablog.example.com/2\nEditURL: http://hatenablog.example.com/2/edit\n"
                                        actual  : "Title: 所内\nCategory:\n- foo\n- bar\nDate: \"2012-12-20T00:00:00+09:00\"\nURL: http://hatenablog.example.com/2\nEditURL: http://hatenablog.example.com/2/edit\n"
                        Test:           TestUnmarshalYAML
FAIL
FAIL    github.com/motemen/blogsync     0.051s
ok      github.com/motemen/blogsync/atom        (cached)
make: *** [test] Error 1

I investigated to fix that, but I'm not confident which (w/ or w/o double quotes) is right.
At least, I think the difference is stems from results of Marshaling time.Date and entryTime...

	date := time.Date(2012, 12, 19, 0, 0, 0, 0, jst)

	md, _ := yaml.Marshal(date)
	me, _ := yaml.Marshal(&entryTime{&d})

	fmt.Println(string(md)) # 2012-12-19T00:00:00+09:00
	fmt.Println(string(me)) # "2012-12-19T00:00:00+09:00"
@Songmu
Copy link
Member

Songmu commented May 7, 2018

Thank you for reporting. It seems to be resolved at #18. Please try it!

@kiririmode
Copy link
Contributor Author

It's resolved! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants