{"action":"created","comment":{"url":"https://api.github.com/repos/SUSE/machinery/pulls/comments/40997128","id":40997128,"diff_hunk":"@@ -0,0 +1,191 @@\n+// Copyright (c) 2015 SUSE LLC\n+//\n+// This program is free software; you can redistribute it and/or\n+// modify it under the terms of version 3 of the GNU General Public License as\n+// published by the Free Software Foundation.\n+//\n+// This program is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the\n+// GNU General Public License for more details.\n+//\n+// You should have received a copy of the GNU General Public License\n+// along with this program; if not, contact SUSE LLC.\n+//\n+// To contact SUSE about this file by physical or electronic mail,\n+// you may find current contact information at www.suse.com\n+\n+package main\n+\n+import (\n+  \"testing\"\n+  \"reflect\"\n+  \"os\"\n+  \"time\"\n+  \"github.com/nowk/go-fakefileinfo\"\n+)\n+\n+func doTestParseRpmLine(t *testing.T, line string, expected_file_type string, expected_file_name string, expected_link_target string) {\n+  file_type, file_name, link_target := parseRpmLine(line)\n+\n+  if file_type != expected_file_type {\n+    t.Errorf(\"parseRpmLine('%s') file type = '%s', want '%s'\", line, file_type, expected_file_type)\n+  }\n+  if file_name != expected_file_name {\n+    t.Errorf(\"parseRpmLine('%s') file name = '%s', want '%s'\", line, file_name, expected_file_name)\n+  }\n+  if link_target != expected_link_target {\n+    t.Errorf(\"parseRpmLine('%s') file type = '%s', want '%s'\", line, link_target, expected_link_target)\n+  }\n+}\n+\n+func TestParseRpmLineFile(t *testing.T) {\n+  line := \"-rw-r--r--    1 root    root                 18234080 Mar 31 11:40 /usr/lib64/libruby2.0-static.a\"\n+\n+  expected_file_type := \"-\"\n+  expected_file_name := \"/usr/lib64/libruby2.0-static.a\"\n+  expected_link_target := \"\"\n+\n+  doTestParseRpmLine(t, line, expected_file_type, expected_file_name, expected_link_target)\n+}\n+\n+func TestParseRpmLineDir(t *testing.T) {\n+  line := \"drwxr-xr-x    2 root    root                        0 Mar 31 11:45 /usr/include/ruby-2.0.0/x86_64-linux/ruby\"\n+\n+  expected_file_type := \"d\"\n+  expected_file_name := \"/usr/include/ruby-2.0.0/x86_64-linux/ruby\"\n+  expected_link_target := \"\"\n+\n+  doTestParseRpmLine(t, line, expected_file_type, expected_file_name, expected_link_target)\n+}\n+\n+func TestParseRpmLineLink(t *testing.T) {\n+  line := \"lrwxrwxrwx    1 root    root                       19 Mar 31 11:45 /usr/lib64/libruby2.0.so -> libruby2.0.so.2.0.0\"\n+\n+  expected_file_type := \"l\"\n+  expected_file_name := \"/usr/lib64/libruby2.0.so\"\n+  expected_link_target := \"libruby2.0.so.2.0.0\"\n+\n+  doTestParseRpmLine(t, line, expected_file_type, expected_file_name, expected_link_target)\n+}\n+\n+func TestParseRpmLineFileSpaces(t *testing.T) {\n+  line := \"-rw-r--r--    1 root    root                    61749 Jun 26 01:56 /usr/share/kde4/templates/kipiplugins_photolayoutseditor/data/templates/a4/h/Flipping Tux Black.ple\"\n+\n+  expected_file_type := \"-\"\n+  expected_file_name := \"/usr/share/kde4/templates/kipiplugins_photolayoutseditor/data/templates/a4/h/Flipping Tux Black.ple\"\n+  expected_link_target := \"\"\n+\n+  doTestParseRpmLine(t, line, expected_file_type, expected_file_name, expected_link_target)\n+}\n+\n+func TestAddImplicitlyManagedDirs(t *testing.T) {\n+  files_original := map[string]string{\n+    \"/abc/def/ghf/somefile\": \"\",\n+    \"/zzz\": \"/abc/def\",\n+  }\n+  dirs_original := map[string]bool{","path":"machinery-helper/machinery_helper_test.go","position":87,"original_position":87,"commit_id":"7662e7dbb9ed0bd0f97d42f4e08e862fed5ae6f1","original_commit_id":"7662e7dbb9ed0bd0f97d42f4e08e862fed5ae6f1","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"don't use underscores in Go names; var dirs_original should be dirsOriginal","created_at":"2015-10-02T07:33:08Z","updated_at":"2015-10-02T07:33:08Z","html_url":"https://github.com/SUSE/machinery/pull/1436#discussion_r40997128","pull_request_url":"https://api.github.com/repos/SUSE/machinery/pulls/1436","_links":{"self":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/comments/40997128"},"html":{"href":"https://github.com/SUSE/machinery/pull/1436#discussion_r40997128"},"pull_request":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/1436"}}},"pull_request":{"url":"https://api.github.com/repos/SUSE/machinery/pulls/1436","id":46555149,"html_url":"https://github.com/SUSE/machinery/pull/1436","diff_url":"https://github.com/SUSE/machinery/pull/1436.diff","patch_url":"https://github.com/SUSE/machinery/pull/1436.patch","issue_url":"https://api.github.com/repos/SUSE/machinery/issues/1436","number":1436,"state":"open","locked":false,"title":"Incorporate machinery helper","user":{"login":"thardeck","id":2063848,"avatar_url":"https://avatars.githubusercontent.com/u/2063848?v=3","gravatar_id":"","url":"https://api.github.com/users/thardeck","html_url":"https://github.com/thardeck","followers_url":"https://api.github.com/users/thardeck/followers","following_url":"https://api.github.com/users/thardeck/following{/other_user}","gists_url":"https://api.github.com/users/thardeck/gists{/gist_id}","starred_url":"https://api.github.com/users/thardeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thardeck/subscriptions","organizations_url":"https://api.github.com/users/thardeck/orgs","repos_url":"https://api.github.com/users/thardeck/repos","events_url":"https://api.github.com/users/thardeck/events{/privacy}","received_events_url":"https://api.github.com/users/thardeck/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-01T17:53:16Z","updated_at":"2015-10-02T07:33:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"832a35e4fc0b74bad77581ad95f43329771af029","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SUSE/machinery/pulls/1436/commits","review_comments_url":"https://api.github.com/repos/SUSE/machinery/pulls/1436/comments","review_comment_url":"https://api.github.com/repos/SUSE/machinery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SUSE/machinery/issues/1436/comments","statuses_url":"https://api.github.com/repos/SUSE/machinery/statuses/7662e7dbb9ed0bd0f97d42f4e08e862fed5ae6f1","head":{"label":"SUSE:incorporate_machinery_helper","ref":"incorporate_machinery_helper","sha":"7662e7dbb9ed0bd0f97d42f4e08e862fed5ae6f1","user":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":21424418,"name":"machinery","full_name":"SUSE/machinery","owner":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SUSE/machinery","description":"A systems management toolkit for Linux","fork":false,"url":"https://api.github.com/repos/SUSE/machinery","forks_url":"https://api.github.com/repos/SUSE/machinery/forks","keys_url":"https://api.github.com/repos/SUSE/machinery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SUSE/machinery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SUSE/machinery/teams","hooks_url":"https://api.github.com/repos/SUSE/machinery/hooks","issue_events_url":"https://api.github.com/repos/SUSE/machinery/issues/events{/number}","events_url":"https://api.github.com/repos/SUSE/machinery/events","assignees_url":"https://api.github.com/repos/SUSE/machinery/assignees{/user}","branches_url":"https://api.github.com/repos/SUSE/machinery/branches{/branch}","tags_url":"https://api.github.com/repos/SUSE/machinery/tags","blobs_url":"https://api.github.com/repos/SUSE/machinery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SUSE/machinery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SUSE/machinery/git/refs{/sha}","trees_url":"https://api.github.com/repos/SUSE/machinery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SUSE/machinery/statuses/{sha}","languages_url":"https://api.github.com/repos/SUSE/machinery/languages","stargazers_url":"https://api.github.com/repos/SUSE/machinery/stargazers","contributors_url":"https://api.github.com/repos/SUSE/machinery/contributors","subscribers_url":"https://api.github.com/repos/SUSE/machinery/subscribers","subscription_url":"https://api.github.com/repos/SUSE/machinery/subscription","commits_url":"https://api.github.com/repos/SUSE/machinery/commits{/sha}","git_commits_url":"https://api.github.com/repos/SUSE/machinery/git/commits{/sha}","comments_url":"https://api.github.com/repos/SUSE/machinery/comments{/number}","issue_comment_url":"https://api.github.com/repos/SUSE/machinery/issues/comments{/number}","contents_url":"https://api.github.com/repos/SUSE/machinery/contents/{+path}","compare_url":"https://api.github.com/repos/SUSE/machinery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SUSE/machinery/merges","archive_url":"https://api.github.com/repos/SUSE/machinery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SUSE/machinery/downloads","issues_url":"https://api.github.com/repos/SUSE/machinery/issues{/number}","pulls_url":"https://api.github.com/repos/SUSE/machinery/pulls{/number}","milestones_url":"https://api.github.com/repos/SUSE/machinery/milestones{/number}","notifications_url":"https://api.github.com/repos/SUSE/machinery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SUSE/machinery/labels{/name}","releases_url":"https://api.github.com/repos/SUSE/machinery/releases{/id}","created_at":"2014-07-02T13:07:04Z","updated_at":"2015-09-30T06:56:09Z","pushed_at":"2015-10-02T07:32:59Z","git_url":"git://github.com/SUSE/machinery.git","ssh_url":"git@github.com:SUSE/machinery.git","clone_url":"https://github.com/SUSE/machinery.git","svn_url":"https://github.com/SUSE/machinery","homepage":"machinery-project.org","size":70275,"stargazers_count":57,"watchers_count":57,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"open_issues_count":34,"forks":11,"open_issues":34,"watchers":57,"default_branch":"master"}},"base":{"label":"SUSE:master","ref":"master","sha":"0b57402c049d3aae39075b9b2dda819162cd7b97","user":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":21424418,"name":"machinery","full_name":"SUSE/machinery","owner":{"login":"SUSE","id":1067733,"avatar_url":"https://avatars.githubusercontent.com/u/1067733?v=3","gravatar_id":"","url":"https://api.github.com/users/SUSE","html_url":"https://github.com/SUSE","followers_url":"https://api.github.com/users/SUSE/followers","following_url":"https://api.github.com/users/SUSE/following{/other_user}","gists_url":"https://api.github.com/users/SUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/SUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SUSE/subscriptions","organizations_url":"https://api.github.com/users/SUSE/orgs","repos_url":"https://api.github.com/users/SUSE/repos","events_url":"https://api.github.com/users/SUSE/events{/privacy}","received_events_url":"https://api.github.com/users/SUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SUSE/machinery","description":"A systems management toolkit for Linux","fork":false,"url":"https://api.github.com/repos/SUSE/machinery","forks_url":"https://api.github.com/repos/SUSE/machinery/forks","keys_url":"https://api.github.com/repos/SUSE/machinery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SUSE/machinery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SUSE/machinery/teams","hooks_url":"https://api.github.com/repos/SUSE/machinery/hooks","issue_events_url":"https://api.github.com/repos/SUSE/machinery/issues/events{/number}","events_url":"https://api.github.com/repos/SUSE/machinery/events","assignees_url":"https://api.github.com/repos/SUSE/machinery/assignees{/user}","branches_url":"https://api.github.com/repos/SUSE/machinery/branches{/branch}","tags_url":"https://api.github.com/repos/SUSE/machinery/tags","blobs_url":"https://api.github.com/repos/SUSE/machinery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SUSE/machinery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SUSE/machinery/git/refs{/sha}","trees_url":"https://api.github.com/repos/SUSE/machinery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SUSE/machinery/statuses/{sha}","languages_url":"https://api.github.com/repos/SUSE/machinery/languages","stargazers_url":"https://api.github.com/repos/SUSE/machinery/stargazers","contributors_url":"https://api.github.com/repos/SUSE/machinery/contributors","subscribers_url":"https://api.github.com/repos/SUSE/machinery/subscribers","subscription_url":"https://api.github.com/repos/SUSE/machinery/subscription","commits_url":"https://api.github.com/repos/SUSE/machinery/commits{/sha}","git_commits_url":"https://api.github.com/repos/SUSE/machinery/git/commits{/sha}","comments_url":"https://api.github.com/repos/SUSE/machinery/comments{/number}","issue_comment_url":"https://api.github.com/repos/SUSE/machinery/issues/comments{/number}","contents_url":"https://api.github.com/repos/SUSE/machinery/contents/{+path}","compare_url":"https://api.github.com/repos/SUSE/machinery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SUSE/machinery/merges","archive_url":"https://api.github.com/repos/SUSE/machinery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SUSE/machinery/downloads","issues_url":"https://api.github.com/repos/SUSE/machinery/issues{/number}","pulls_url":"https://api.github.com/repos/SUSE/machinery/pulls{/number}","milestones_url":"https://api.github.com/repos/SUSE/machinery/milestones{/number}","notifications_url":"https://api.github.com/repos/SUSE/machinery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SUSE/machinery/labels{/name}","releases_url":"https://api.github.com/repos/SUSE/machinery/releases{/id}","created_at":"2014-07-02T13:07:04Z","updated_at":"2015-09-30T06:56:09Z","pushed_at":"2015-10-02T07:32:59Z","git_url":"git://github.com/SUSE/machinery.git","ssh_url":"git@github.com:SUSE/machinery.git","clone_url":"https://github.com/SUSE/machinery.git","svn_url":"https://github.com/SUSE/machinery","homepage":"machinery-project.org","size":70275,"stargazers_count":57,"watchers_count":57,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"open_issues_count":34,"forks":11,"open_issues":34,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/1436"},"html":{"href":"https://github.com/SUSE/machinery/pull/1436"},"issue":{"href":"https://api.github.com/repos/SUSE/machinery/issues/1436"},"comments":{"href":"https://api.github.com/repos/SUSE/machinery/issues/1436/comments"},"review_comments":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/1436/comments"},"review_comment":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SUSE/machinery/pulls/1436/commits"},"statuses":{"href":"https://api.github.com/repos/SUSE/machinery/statuses/7662e7dbb9ed0bd0f97d42f4e08e862fed5ae6f1"}}}}