{"action":"created","comment":{"url":"https://api.github.com/repos/Tlf/tlf/pulls/comments/175263524","pull_request_review_id":104771957,"id":175263524,"diff_hunk":"@@ -0,0 +1,152 @@\n+#include \"test.h\"\n+\n+#include \"../src/globalvars.h\"\n+\n+#include \"../src/tlf_curses.h\"\n+#include \"../src/tlf_panel.h\"\n+#include \"../src/searchlog.h\"\n+#include \"../src/dxcc.h\"\n+\n+// OBJECT ../src/searchlog.o\n+// OBJECT ../src/zone_nr.o\n+// OBJECT ../src/searchcallarray.o\n+// OBJECT ../src/nicebox.o\n+// OBJECT ../src/qtcutil.o\n+// OBJECT ../src/printcall.o\n+\n+extern WINDOW *search_win;\n+extern int nr_bands;\n+\n+const char *NOT_SET = \"__NOT_SET__\";\n+\n+static const char *msg, *msg1, *msg2;\n+\n+void showmsg(char *message) {\n+    msg = message;\n+}\n+\n+void showstring(char *message1, char *message2) {\n+    msg1 = message1;\n+    msg2 = message2;\n+}\n+\n+/*********************/\n+// mocks\n+\n+// stoptx.c\n+int stoptx() {\n+    return 0;\n+}\n+\n+// ui_utils.c\n+int modify_attr(int attr) {\n+    return attr;\n+}\n+\n+// get_time.c\n+void get_time(void) {\n+}\n+\n+// getpx.c\n+void getpx(char *checkcall) {\n+}\n+\n+// dxcc.c\n+dxcc_data *dxcc_by_index(unsigned int index) {\n+    return NULL; //oops\n+}\n+\n+// getctydata.c\n+int getctydata(char *checkcallptr) {\n+    return 0;\n+}\n+/*********************/\n+\n+int setup_default(void **state) {\n+    msg = msg1 = msg2 = NOT_SET;\n+    arrlss = 0;\n+    dxped = 0;\n+    contest = 0;\n+    search_win = NULL;\n+    return 0;\n+}\n+\n+// callmaster is checked first in current directory,\n+// create it there\n+static void write_callmaster(const char *content) {\n+    FILE *f = fopen(\"callmaster\", \"w\");\n+    assert_non_null(f);\n+    fputs(content, f);\n+    fclose(f);\n+}\n+\n+static void remove_callmaster() {\n+    unlink(\"callmaster\");   // no need to check if file exists\n+}\n+\n+int teardown_default(void **state) {\n+    remove_callmaster();\n+    return 0;\n+}\n+\n+void test_callmaster_no_file(void **state) {\n+    remove_callmaster();\n+    int n = load_callmaster();\n+    assert_int_equal(n, 0);","path":"test/test_searchlog.c","position":82,"original_position":95,"commit_id":"ca4c38544233455e0ffeda717b40f90c0be5cf14","original_commit_id":"076bbf4324e87407da1d21debb3d6dc6abea500a","user":{"login":"dl1jbe","id":934289,"avatar_url":"https://avatars3.githubusercontent.com/u/934289?v=4","gravatar_id":"","url":"https://api.github.com/users/dl1jbe","html_url":"https://github.com/dl1jbe","followers_url":"https://api.github.com/users/dl1jbe/followers","following_url":"https://api.github.com/users/dl1jbe/following{/other_user}","gists_url":"https://api.github.com/users/dl1jbe/gists{/gist_id}","starred_url":"https://api.github.com/users/dl1jbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dl1jbe/subscriptions","organizations_url":"https://api.github.com/users/dl1jbe/orgs","repos_url":"https://api.github.com/users/dl1jbe/repos","events_url":"https://api.github.com/users/dl1jbe/events{/privacy}","received_events_url":"https://api.github.com/users/dl1jbe/received_events","type":"User","site_admin":false},"body":"That test fails as soon as TLF is already installed. 'load_callmaster()' is also looking in the PACKAGE_DATA_DIR location where a callmaster file is present in that case.\r\n","created_at":"2018-03-17T16:57:04Z","updated_at":"2018-03-17T16:57:04Z","html_url":"https://github.com/Tlf/tlf/pull/91#discussion_r175263524","pull_request_url":"https://api.github.com/repos/Tlf/tlf/pulls/91","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/comments/175263524"},"html":{"href":"https://github.com/Tlf/tlf/pull/91#discussion_r175263524"},"pull_request":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/Tlf/tlf/pulls/91","id":172334287,"html_url":"https://github.com/Tlf/tlf/pull/91","diff_url":"https://github.com/Tlf/tlf/pull/91.diff","patch_url":"https://github.com/Tlf/tlf/pull/91.patch","issue_url":"https://api.github.com/repos/Tlf/tlf/issues/91","number":91,"state":"open","locked":false,"title":"Added test for searchlog","user":{"login":"zcsahok","id":15141948,"avatar_url":"https://avatars1.githubusercontent.com/u/15141948?v=4","gravatar_id":"","url":"https://api.github.com/users/zcsahok","html_url":"https://github.com/zcsahok","followers_url":"https://api.github.com/users/zcsahok/followers","following_url":"https://api.github.com/users/zcsahok/following{/other_user}","gists_url":"https://api.github.com/users/zcsahok/gists{/gist_id}","starred_url":"https://api.github.com/users/zcsahok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcsahok/subscriptions","organizations_url":"https://api.github.com/users/zcsahok/orgs","repos_url":"https://api.github.com/users/zcsahok/repos","events_url":"https://api.github.com/users/zcsahok/events{/privacy}","received_events_url":"https://api.github.com/users/zcsahok/received_events","type":"User","site_admin":false},"body":"Covering mostly `load_callmaster`. Other functions need curses mocking, and more work...\r\n\r\nAllowing leading spaces in callmaster file, just in case. Made reading loop more compact.\r\n\r\nTo do: opening file from package dir should be done in a common function.\r\n","created_at":"2018-03-01T19:43:47Z","updated_at":"2018-03-17T16:57:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c2a97a2745cba1b691e1eaa28c0cc36f4e436ea","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Tlf/tlf/pulls/91/commits","review_comments_url":"https://api.github.com/repos/Tlf/tlf/pulls/91/comments","review_comment_url":"https://api.github.com/repos/Tlf/tlf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Tlf/tlf/issues/91/comments","statuses_url":"https://api.github.com/repos/Tlf/tlf/statuses/ca4c38544233455e0ffeda717b40f90c0be5cf14","head":{"label":"zcsahok:test_searchlog","ref":"test_searchlog","sha":"ca4c38544233455e0ffeda717b40f90c0be5cf14","user":{"login":"zcsahok","id":15141948,"avatar_url":"https://avatars1.githubusercontent.com/u/15141948?v=4","gravatar_id":"","url":"https://api.github.com/users/zcsahok","html_url":"https://github.com/zcsahok","followers_url":"https://api.github.com/users/zcsahok/followers","following_url":"https://api.github.com/users/zcsahok/following{/other_user}","gists_url":"https://api.github.com/users/zcsahok/gists{/gist_id}","starred_url":"https://api.github.com/users/zcsahok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcsahok/subscriptions","organizations_url":"https://api.github.com/users/zcsahok/orgs","repos_url":"https://api.github.com/users/zcsahok/repos","events_url":"https://api.github.com/users/zcsahok/events{/privacy}","received_events_url":"https://api.github.com/users/zcsahok/received_events","type":"User","site_admin":false},"repo":{"id":58203156,"name":"tlf","full_name":"zcsahok/tlf","owner":{"login":"zcsahok","id":15141948,"avatar_url":"https://avatars1.githubusercontent.com/u/15141948?v=4","gravatar_id":"","url":"https://api.github.com/users/zcsahok","html_url":"https://github.com/zcsahok","followers_url":"https://api.github.com/users/zcsahok/followers","following_url":"https://api.github.com/users/zcsahok/following{/other_user}","gists_url":"https://api.github.com/users/zcsahok/gists{/gist_id}","starred_url":"https://api.github.com/users/zcsahok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcsahok/subscriptions","organizations_url":"https://api.github.com/users/zcsahok/orgs","repos_url":"https://api.github.com/users/zcsahok/repos","events_url":"https://api.github.com/users/zcsahok/events{/privacy}","received_events_url":"https://api.github.com/users/zcsahok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zcsahok/tlf","description":"TLF - a console based ham radio contest logger","fork":true,"url":"https://api.github.com/repos/zcsahok/tlf","forks_url":"https://api.github.com/repos/zcsahok/tlf/forks","keys_url":"https://api.github.com/repos/zcsahok/tlf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zcsahok/tlf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zcsahok/tlf/teams","hooks_url":"https://api.github.com/repos/zcsahok/tlf/hooks","issue_events_url":"https://api.github.com/repos/zcsahok/tlf/issues/events{/number}","events_url":"https://api.github.com/repos/zcsahok/tlf/events","assignees_url":"https://api.github.com/repos/zcsahok/tlf/assignees{/user}","branches_url":"https://api.github.com/repos/zcsahok/tlf/branches{/branch}","tags_url":"https://api.github.com/repos/zcsahok/tlf/tags","blobs_url":"https://api.github.com/repos/zcsahok/tlf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zcsahok/tlf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zcsahok/tlf/git/refs{/sha}","trees_url":"https://api.github.com/repos/zcsahok/tlf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zcsahok/tlf/statuses/{sha}","languages_url":"https://api.github.com/repos/zcsahok/tlf/languages","stargazers_url":"https://api.github.com/repos/zcsahok/tlf/stargazers","contributors_url":"https://api.github.com/repos/zcsahok/tlf/contributors","subscribers_url":"https://api.github.com/repos/zcsahok/tlf/subscribers","subscription_url":"https://api.github.com/repos/zcsahok/tlf/subscription","commits_url":"https://api.github.com/repos/zcsahok/tlf/commits{/sha}","git_commits_url":"https://api.github.com/repos/zcsahok/tlf/git/commits{/sha}","comments_url":"https://api.github.com/repos/zcsahok/tlf/comments{/number}","issue_comment_url":"https://api.github.com/repos/zcsahok/tlf/issues/comments{/number}","contents_url":"https://api.github.com/repos/zcsahok/tlf/contents/{+path}","compare_url":"https://api.github.com/repos/zcsahok/tlf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zcsahok/tlf/merges","archive_url":"https://api.github.com/repos/zcsahok/tlf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zcsahok/tlf/downloads","issues_url":"https://api.github.com/repos/zcsahok/tlf/issues{/number}","pulls_url":"https://api.github.com/repos/zcsahok/tlf/pulls{/number}","milestones_url":"https://api.github.com/repos/zcsahok/tlf/milestones{/number}","notifications_url":"https://api.github.com/repos/zcsahok/tlf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zcsahok/tlf/labels{/name}","releases_url":"https://api.github.com/repos/zcsahok/tlf/releases{/id}","deployments_url":"https://api.github.com/repos/zcsahok/tlf/deployments","created_at":"2016-05-06T11:36:43Z","updated_at":"2016-05-06T11:36:45Z","pushed_at":"2018-03-03T21:09:09Z","git_url":"git://github.com/zcsahok/tlf.git","ssh_url":"git@github.com:zcsahok/tlf.git","clone_url":"https://github.com/zcsahok/tlf.git","svn_url":"https://github.com/zcsahok/tlf","homepage":"","size":4842,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Tlf:master","ref":"master","sha":"78288bcabc75b6edabce92cd7dcab08b698cca0f","user":{"login":"Tlf","id":1055026,"avatar_url":"https://avatars3.githubusercontent.com/u/1055026?v=4","gravatar_id":"","url":"https://api.github.com/users/Tlf","html_url":"https://github.com/Tlf","followers_url":"https://api.github.com/users/Tlf/followers","following_url":"https://api.github.com/users/Tlf/following{/other_user}","gists_url":"https://api.github.com/users/Tlf/gists{/gist_id}","starred_url":"https://api.github.com/users/Tlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tlf/subscriptions","organizations_url":"https://api.github.com/users/Tlf/orgs","repos_url":"https://api.github.com/users/Tlf/repos","events_url":"https://api.github.com/users/Tlf/events{/privacy}","received_events_url":"https://api.github.com/users/Tlf/received_events","type":"Organization","site_admin":false},"repo":{"id":2383224,"name":"tlf","full_name":"Tlf/tlf","owner":{"login":"Tlf","id":1055026,"avatar_url":"https://avatars3.githubusercontent.com/u/1055026?v=4","gravatar_id":"","url":"https://api.github.com/users/Tlf","html_url":"https://github.com/Tlf","followers_url":"https://api.github.com/users/Tlf/followers","following_url":"https://api.github.com/users/Tlf/following{/other_user}","gists_url":"https://api.github.com/users/Tlf/gists{/gist_id}","starred_url":"https://api.github.com/users/Tlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tlf/subscriptions","organizations_url":"https://api.github.com/users/Tlf/orgs","repos_url":"https://api.github.com/users/Tlf/repos","events_url":"https://api.github.com/users/Tlf/events{/privacy}","received_events_url":"https://api.github.com/users/Tlf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tlf/tlf","description":"TLF - a console based ham radio contest logger","fork":false,"url":"https://api.github.com/repos/Tlf/tlf","forks_url":"https://api.github.com/repos/Tlf/tlf/forks","keys_url":"https://api.github.com/repos/Tlf/tlf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tlf/tlf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tlf/tlf/teams","hooks_url":"https://api.github.com/repos/Tlf/tlf/hooks","issue_events_url":"https://api.github.com/repos/Tlf/tlf/issues/events{/number}","events_url":"https://api.github.com/repos/Tlf/tlf/events","assignees_url":"https://api.github.com/repos/Tlf/tlf/assignees{/user}","branches_url":"https://api.github.com/repos/Tlf/tlf/branches{/branch}","tags_url":"https://api.github.com/repos/Tlf/tlf/tags","blobs_url":"https://api.github.com/repos/Tlf/tlf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tlf/tlf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tlf/tlf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tlf/tlf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tlf/tlf/statuses/{sha}","languages_url":"https://api.github.com/repos/Tlf/tlf/languages","stargazers_url":"https://api.github.com/repos/Tlf/tlf/stargazers","contributors_url":"https://api.github.com/repos/Tlf/tlf/contributors","subscribers_url":"https://api.github.com/repos/Tlf/tlf/subscribers","subscription_url":"https://api.github.com/repos/Tlf/tlf/subscription","commits_url":"https://api.github.com/repos/Tlf/tlf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tlf/tlf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tlf/tlf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tlf/tlf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tlf/tlf/contents/{+path}","compare_url":"https://api.github.com/repos/Tlf/tlf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tlf/tlf/merges","archive_url":"https://api.github.com/repos/Tlf/tlf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tlf/tlf/downloads","issues_url":"https://api.github.com/repos/Tlf/tlf/issues{/number}","pulls_url":"https://api.github.com/repos/Tlf/tlf/pulls{/number}","milestones_url":"https://api.github.com/repos/Tlf/tlf/milestones{/number}","notifications_url":"https://api.github.com/repos/Tlf/tlf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tlf/tlf/labels{/name}","releases_url":"https://api.github.com/repos/Tlf/tlf/releases{/id}","deployments_url":"https://api.github.com/repos/Tlf/tlf/deployments","created_at":"2011-09-14T04:21:10Z","updated_at":"2018-03-17T15:56:44Z","pushed_at":"2018-03-03T21:09:10Z","git_url":"git://github.com/Tlf/tlf.git","ssh_url":"git@github.com:Tlf/tlf.git","clone_url":"https://github.com/Tlf/tlf.git","svn_url":"https://github.com/Tlf/tlf","homepage":"https://tlf.github.io","size":4825,"stargazers_count":17,"watchers_count":17,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":9,"open_issues":3,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/91"},"html":{"href":"https://github.com/Tlf/tlf/pull/91"},"issue":{"href":"https://api.github.com/repos/Tlf/tlf/issues/91"},"comments":{"href":"https://api.github.com/repos/Tlf/tlf/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/Tlf/tlf/statuses/ca4c38544233455e0ffeda717b40f90c0be5cf14"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dl1jbe"}}