fix fetch test's expected results and check results properly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
diff --git a/regress/fetch/fetch_test.c b/regress/fetch/fetch_test.c
index ff64378..31b97a8 100644
--- a/regress/fetch/fetch_test.c
+++ b/regress/fetch/fetch_test.c
@@ -83,35 +83,42 @@ fetch_parse_uri(void)
NULL, NULL, NULL, NULL, NULL, GOT_ERR_PARSE_URI },
{ "git://127.0.0.1/git/myrepo",
- "git", "localhost", GOT_DEFAULT_GIT_PORT_STR, "git",
- "myrepo", GOT_ERR_OK },
+ "git", "127.0.0.1", GOT_DEFAULT_GIT_PORT_STR,
+ "/git/myrepo", "myrepo", GOT_ERR_OK },
{ "http://127.0.0.1/git/myrepo",
- "http", "localhost", GOT_DEFAULT_GIT_PORT_STR, "git",
- "myrepo", GOT_ERR_OK },
+ "http", "127.0.0.1", GOT_DEFAULT_GIT_PORT_STR,
+ "/git/myrepo", "myrepo", GOT_ERR_OK },
{ "gopher://127.0.0.1/git/myrepo",
- "gopher", "localhost", GOT_DEFAULT_GIT_PORT_STR, "git",
- "myrepo", GOT_ERR_OK },
+ "gopher", "127.0.0.1", GOT_DEFAULT_GIT_PORT_STR,
+ "/git/myrepo", "myrepo", GOT_ERR_OK },
{ "git://127.0.0.1:22/git/myrepo",
- "git", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
-
+ "git", "127.0.0.1", "22", "/git/myrepo", "myrepo",
+ GOT_ERR_OK },
{ "git://127.0.0.1/git/repos/foo/bar/myrepo.git",
- "git", "localhost", GOT_DEFAULT_GIT_PORT_STR,
- "git/repos/foo/bar", "myrepo", GOT_ERR_OK },
+ "git", "127.0.0.1", GOT_DEFAULT_GIT_PORT_STR,
+ "/git/repos/foo/bar/myrepo.git", "myrepo", GOT_ERR_OK },
{ "https://127.0.0.1/git/repos/foo/../bar/myrepo.git",
- "https", "localhost", GOT_DEFAULT_GIT_PORT_STR,
- "git/repos/foo/../bar", "myrepo", GOT_ERR_OK },
+ "https", "127.0.0.1", GOT_DEFAULT_GIT_PORT_STR,
+ "/git/repos/foo/../bar/myrepo.git", "myrepo",
+ GOT_ERR_OK },
{ "git+ssh://127.0.0.1:22/git/myrepo",
- "git+ssh", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
+ "git+ssh", "127.0.0.1", "22", "/git/myrepo", "myrepo",
+ GOT_ERR_OK },
{ "ssh://127.0.0.1:22/git/myrepo",
- "ssh", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
+ "ssh", "127.0.0.1", "22", "/git/myrepo", "myrepo",
+ GOT_ERR_OK },
+
{ "127.0.0.1:git/myrepo",
- "ssh", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
+ "ssh", "127.0.0.1", "22", "git/myrepo", "myrepo",
+ GOT_ERR_OK },
{ "127.0.0.1:/git/myrepo",
- "ssh", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
+ "ssh", "127.0.0.1", "22", "/git/myrepo", "myrepo",
+ GOT_ERR_OK },
{ "127.0.0.1:22/git/myrepo",
- "ssh", "localhost", "22", "git", "myrepo", GOT_ERR_OK },
+ "ssh", "127.0.0.1", "22", "22/git/myrepo", "myrepo",
+ GOT_ERR_OK },
};
int i;
@@ -187,6 +194,32 @@ fetch_parse_uri(void)
return 0;
}
+ if (expected_host != NULL && strcmp(expected_host, host)) {
+ test_printf("%d: host %s; expected %s\n", i, host,
+ expected_host);
+ return 0;
+ }
+
+ if (expected_port != NULL && strcmp(expected_port, port)) {
+ test_printf("%d: port %s; expected %s\n", i, port,
+ expected_port);
+ return 0;
+ }
+
+ if (expected_server_path != NULL &&
+ strcmp(expected_server_path, server_path)) {
+ test_printf("%d: server_path %s; expected %s\n", i,
+ server_path, expected_server_path);
+ return 0;
+ }
+
+ if (expected_repo_name != NULL &&
+ strcmp(expected_repo_name, repo_name)) {
+ test_printf("%d: repo_name %s; expected %s\n", i,
+ repo_name, expected_repo_name);
+ return 0;
+ }
+
free(proto);
proto = NULL;
free(host);