{"action":"created","comment":{"url":"https://api.github.com/repos/exercism/xgo/pulls/comments/26436473","id":26436473,"diff_hunk":"@@ -0,0 +1,308 @@\n+package ledger\n+\n+import (\n+\t\"reflect\"\n+\t\"strings\"\n+\t\"testing\"\n+)\n+\n+const testVersion = 1\n+\n+var successTestCases = []struct {\n+\tname     string\n+\tcurrency string\n+\tlocale   string\n+\tentries  []Entry\n+\texpected string\n+}{\n+\t{\n+\t\tname:     \"empty ledger\",\n+\t\tcurrency: \"USD\",\n+\t\tlocale:   \"en-US\",\n+\t\tentries:  nil,\n+\t\texpected: `\n+Date       | Description               | Change\n+`,\n+\t},\n+\t{\n+\t\tname:     \"one entry\",\n+\t\tcurrency: \"USD\",\n+\t\tlocale:   \"en-US\",\n+\t\tentries: []Entry{\n+\t\t\t{\n+\t\t\t\tDate:        \"2015-01-01\",\n+\t\t\t\tDescription: \"Buy present\",\n+\t\t\t\tChange:      -1000,\n+\t\t\t},\n+\t\t},\n+\t\texpected: `\n+Date       | Description               | Change\n+01/01/2015 | Buy present               |      ($10.00)\n+`,\n+\t},\n+\t{\n+\t\tname:     \"credit and debit\",\n+\t\tcurrency: \"USD\",\n+\t\tlocale:   \"en-US\",\n+\t\tentries: []Entry{\n+\t\t\t{\n+\t\t\t\tDate:        \"2015-01-02\",\n+\t\t\t\tDescription: \"Get present\",\n+\t\t\t\tChange:      1000,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\tDate:        \"2015-01-01\",\n+\t\t\t\tDescription: \"Buy present\",\n+\t\t\t\tChange:      -1000,\n+\t\t\t},\n+\t\t},\n+\t\texpected: `\n+Date       | Description               | Change\n+01/01/2015 | Buy present               |      ($10.00)\n+01/02/2015 | Get present               |       $10.00 \n+`,\n+\t},\n+\t{\n+\t\tname:     \"multiple entries on same date ordered by description\",\n+\t\tcurrency: \"USD\",\n+\t\tlocale:   \"en-US\",\n+\t\tentries: []Entry{\n+\t\t\t{\n+\t\t\t\tDate:        \"2015-01-01\",\n+\t\t\t\tDescription: \"Buy present\",\n+\t\t\t\tChange:      -1000,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\tDate:        \"2015-01-01\",\n+\t\t\t\tDescription: \"Get present\",\n+\t\t\t\tChange:      1000,\n+\t\t\t},\n+\t\t},\n+\t\texpected: `\n+Date       | Description               | Change\n+01/01/2015 | Buy present               |      ($10.00)\n+01/01/2015 | Get present               |       $10.00 \n+`,\n+\t},\n+\t{\n+\t\tname:     \"final order tie breaker is change\",","path":"ledger/ledger_test.go","position":88,"original_position":88,"commit_id":"71865a6bb773149ea57e023bca7d80c4c14e8a5b","original_commit_id":"eb0ca635663a7d02e23838115c0b14f7f09b79f1","user":{"login":"pminten","id":4168875,"avatar_url":"https://avatars.githubusercontent.com/u/4168875?v=3","gravatar_id":"","url":"https://api.github.com/users/pminten","html_url":"https://github.com/pminten","followers_url":"https://api.github.com/users/pminten/followers","following_url":"https://api.github.com/users/pminten/following{/other_user}","gists_url":"https://api.github.com/users/pminten/gists{/gist_id}","starred_url":"https://api.github.com/users/pminten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pminten/subscriptions","organizations_url":"https://api.github.com/users/pminten/orgs","repos_url":"https://api.github.com/users/pminten/repos","events_url":"https://api.github.com/users/pminten/events{/privacy}","received_events_url":"https://api.github.com/users/pminten/received_events","type":"User","site_admin":false},"body":"Yes, the ordering is ORDER BY date ASC, description ASC, change ASC.","created_at":"2015-03-14T08:36:28Z","updated_at":"2015-03-14T08:36:28Z","html_url":"https://github.com/exercism/xgo/pull/141#discussion_r26436473","pull_request_url":"https://api.github.com/repos/exercism/xgo/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/exercism/xgo/pulls/comments/26436473"},"html":{"href":"https://github.com/exercism/xgo/pull/141#discussion_r26436473"},"pull_request":{"href":"https://api.github.com/repos/exercism/xgo/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/exercism/xgo/pulls/141","id":31120254,"html_url":"https://github.com/exercism/xgo/pull/141","diff_url":"https://github.com/exercism/xgo/pull/141.diff","patch_url":"https://github.com/exercism/xgo/pull/141.patch","issue_url":"https://api.github.com/repos/exercism/xgo/issues/141","number":141,"state":"open","locked":false,"title":"Ledger refactoring exercise","user":{"login":"pminten","id":4168875,"avatar_url":"https://avatars.githubusercontent.com/u/4168875?v=3","gravatar_id":"","url":"https://api.github.com/users/pminten","html_url":"https://github.com/pminten","followers_url":"https://api.github.com/users/pminten/followers","following_url":"https://api.github.com/users/pminten/following{/other_user}","gists_url":"https://api.github.com/users/pminten/gists{/gist_id}","starred_url":"https://api.github.com/users/pminten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pminten/subscriptions","organizations_url":"https://api.github.com/users/pminten/orgs","repos_url":"https://api.github.com/users/pminten/repos","events_url":"https://api.github.com/users/pminten/events{/privacy}","received_events_url":"https://api.github.com/users/pminten/received_events","type":"User","site_admin":false},"body":"This is my first attempt at a refactoring exercise, as we discussed on the exercism mailing list.\r\n\r\nHave kept this unsquashed in order to make it easier to understand how I've gone from the example to the exercise. Will squash after review.\r\n\r\nI'm not sure where in the line of exercises this should go, added to the end of config.json just to make travis work.\r\n\r\nBecause this exercise has two versions (ledger.go and example.go) that should (and do) both pass the tests I had to use a build flag. To test example.go and not ledger.go you need to run `go test -example`. I've changed .travis.yml to do this automatically.\r\n\r\nNote that it's not really desirable to test ledger.go automatically as it contains a race condition which leads to tests failing if it's triggered. The race is very race (I haven't seen it actually trigger) but it could result in spurious test failures.","created_at":"2015-03-13T12:04:09Z","updated_at":"2015-03-14T08:36:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2d3787b9c56775dd46102f529f8830134f2bffb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/exercism/xgo/pulls/141/commits","review_comments_url":"https://api.github.com/repos/exercism/xgo/pulls/141/comments","review_comment_url":"https://api.github.com/repos/exercism/xgo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/exercism/xgo/issues/141/comments","statuses_url":"https://api.github.com/repos/exercism/xgo/statuses/71865a6bb773149ea57e023bca7d80c4c14e8a5b","head":{"label":"pminten:ledger","ref":"ledger","sha":"71865a6bb773149ea57e023bca7d80c4c14e8a5b","user":{"login":"pminten","id":4168875,"avatar_url":"https://avatars.githubusercontent.com/u/4168875?v=3","gravatar_id":"","url":"https://api.github.com/users/pminten","html_url":"https://github.com/pminten","followers_url":"https://api.github.com/users/pminten/followers","following_url":"https://api.github.com/users/pminten/following{/other_user}","gists_url":"https://api.github.com/users/pminten/gists{/gist_id}","starred_url":"https://api.github.com/users/pminten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pminten/subscriptions","organizations_url":"https://api.github.com/users/pminten/orgs","repos_url":"https://api.github.com/users/pminten/repos","events_url":"https://api.github.com/users/pminten/events{/privacy}","received_events_url":"https://api.github.com/users/pminten/received_events","type":"User","site_admin":false},"repo":{"id":31609674,"name":"xgo","full_name":"pminten/xgo","owner":{"login":"pminten","id":4168875,"avatar_url":"https://avatars.githubusercontent.com/u/4168875?v=3","gravatar_id":"","url":"https://api.github.com/users/pminten","html_url":"https://github.com/pminten","followers_url":"https://api.github.com/users/pminten/followers","following_url":"https://api.github.com/users/pminten/following{/other_user}","gists_url":"https://api.github.com/users/pminten/gists{/gist_id}","starred_url":"https://api.github.com/users/pminten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pminten/subscriptions","organizations_url":"https://api.github.com/users/pminten/orgs","repos_url":"https://api.github.com/users/pminten/repos","events_url":"https://api.github.com/users/pminten/events{/privacy}","received_events_url":"https://api.github.com/users/pminten/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pminten/xgo","description":"Exercism Exercises in Go","fork":true,"url":"https://api.github.com/repos/pminten/xgo","forks_url":"https://api.github.com/repos/pminten/xgo/forks","keys_url":"https://api.github.com/repos/pminten/xgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pminten/xgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pminten/xgo/teams","hooks_url":"https://api.github.com/repos/pminten/xgo/hooks","issue_events_url":"https://api.github.com/repos/pminten/xgo/issues/events{/number}","events_url":"https://api.github.com/repos/pminten/xgo/events","assignees_url":"https://api.github.com/repos/pminten/xgo/assignees{/user}","branches_url":"https://api.github.com/repos/pminten/xgo/branches{/branch}","tags_url":"https://api.github.com/repos/pminten/xgo/tags","blobs_url":"https://api.github.com/repos/pminten/xgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pminten/xgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pminten/xgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/pminten/xgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pminten/xgo/statuses/{sha}","languages_url":"https://api.github.com/repos/pminten/xgo/languages","stargazers_url":"https://api.github.com/repos/pminten/xgo/stargazers","contributors_url":"https://api.github.com/repos/pminten/xgo/contributors","subscribers_url":"https://api.github.com/repos/pminten/xgo/subscribers","subscription_url":"https://api.github.com/repos/pminten/xgo/subscription","commits_url":"https://api.github.com/repos/pminten/xgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/pminten/xgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/pminten/xgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/pminten/xgo/issues/comments{/number}","contents_url":"https://api.github.com/repos/pminten/xgo/contents/{+path}","compare_url":"https://api.github.com/repos/pminten/xgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pminten/xgo/merges","archive_url":"https://api.github.com/repos/pminten/xgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pminten/xgo/downloads","issues_url":"https://api.github.com/repos/pminten/xgo/issues{/number}","pulls_url":"https://api.github.com/repos/pminten/xgo/pulls{/number}","milestones_url":"https://api.github.com/repos/pminten/xgo/milestones{/number}","notifications_url":"https://api.github.com/repos/pminten/xgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pminten/xgo/labels{/name}","releases_url":"https://api.github.com/repos/pminten/xgo/releases{/id}","created_at":"2015-03-03T16:51:26Z","updated_at":"2015-03-03T16:51:27Z","pushed_at":"2015-03-14T08:35:45Z","git_url":"git://github.com/pminten/xgo.git","ssh_url":"git@github.com:pminten/xgo.git","clone_url":"https://github.com/pminten/xgo.git","svn_url":"https://github.com/pminten/xgo","homepage":null,"size":489,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"exercism:master","ref":"master","sha":"299721f67f5ffcc789c83583ed966fd6a777d671","user":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"repo":{"id":17273223,"name":"xgo","full_name":"exercism/xgo","owner":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exercism/xgo","description":"Exercism Exercises in Go","fork":false,"url":"https://api.github.com/repos/exercism/xgo","forks_url":"https://api.github.com/repos/exercism/xgo/forks","keys_url":"https://api.github.com/repos/exercism/xgo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exercism/xgo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exercism/xgo/teams","hooks_url":"https://api.github.com/repos/exercism/xgo/hooks","issue_events_url":"https://api.github.com/repos/exercism/xgo/issues/events{/number}","events_url":"https://api.github.com/repos/exercism/xgo/events","assignees_url":"https://api.github.com/repos/exercism/xgo/assignees{/user}","branches_url":"https://api.github.com/repos/exercism/xgo/branches{/branch}","tags_url":"https://api.github.com/repos/exercism/xgo/tags","blobs_url":"https://api.github.com/repos/exercism/xgo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exercism/xgo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exercism/xgo/git/refs{/sha}","trees_url":"https://api.github.com/repos/exercism/xgo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exercism/xgo/statuses/{sha}","languages_url":"https://api.github.com/repos/exercism/xgo/languages","stargazers_url":"https://api.github.com/repos/exercism/xgo/stargazers","contributors_url":"https://api.github.com/repos/exercism/xgo/contributors","subscribers_url":"https://api.github.com/repos/exercism/xgo/subscribers","subscription_url":"https://api.github.com/repos/exercism/xgo/subscription","commits_url":"https://api.github.com/repos/exercism/xgo/commits{/sha}","git_commits_url":"https://api.github.com/repos/exercism/xgo/git/commits{/sha}","comments_url":"https://api.github.com/repos/exercism/xgo/comments{/number}","issue_comment_url":"https://api.github.com/repos/exercism/xgo/issues/comments{/number}","contents_url":"https://api.github.com/repos/exercism/xgo/contents/{+path}","compare_url":"https://api.github.com/repos/exercism/xgo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exercism/xgo/merges","archive_url":"https://api.github.com/repos/exercism/xgo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exercism/xgo/downloads","issues_url":"https://api.github.com/repos/exercism/xgo/issues{/number}","pulls_url":"https://api.github.com/repos/exercism/xgo/pulls{/number}","milestones_url":"https://api.github.com/repos/exercism/xgo/milestones{/number}","notifications_url":"https://api.github.com/repos/exercism/xgo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exercism/xgo/labels{/name}","releases_url":"https://api.github.com/repos/exercism/xgo/releases{/id}","created_at":"2014-02-28T02:51:19Z","updated_at":"2015-03-09T13:36:53Z","pushed_at":"2015-03-09T13:36:53Z","git_url":"git://github.com/exercism/xgo.git","ssh_url":"git@github.com:exercism/xgo.git","clone_url":"https://github.com/exercism/xgo.git","svn_url":"https://github.com/exercism/xgo","homepage":null,"size":26641,"stargazers_count":44,"watchers_count":44,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":6,"forks":16,"open_issues":6,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/exercism/xgo/pulls/141"},"html":{"href":"https://github.com/exercism/xgo/pull/141"},"issue":{"href":"https://api.github.com/repos/exercism/xgo/issues/141"},"comments":{"href":"https://api.github.com/repos/exercism/xgo/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/exercism/xgo/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/exercism/xgo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/exercism/xgo/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/exercism/xgo/statuses/71865a6bb773149ea57e023bca7d80c4c14e8a5b"}}}}