Commit f9546b14 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

test: Fix url test on Mac OS X.

Basically this test was expecting that /tmp is a directory. On Mac OS X /tmp is a link to /private/tmp.

We work around by getting the current work directory after chdir.
parent 24cddfa0
...@@ -66,6 +66,15 @@ static inline void test_path (const char *in, const char *out) ...@@ -66,6 +66,15 @@ static inline void test_path (const char *in, const char *out)
test (make_URI, in, out); test (make_URI, in, out);
} }
static inline void test_current_directory_path (const char *in, const char *cwd, const char *out)
{
char * expected_result = NULL;
int val = asprintf(&expected_result, "file://%s/%s", cwd, out);
assert (val != -1);
test (make_URI, in, expected_result);
}
int main (void) int main (void)
{ {
int val; int val;
...@@ -114,9 +123,16 @@ int main (void) ...@@ -114,9 +123,16 @@ int main (void)
assert (fd != -1);*/ assert (fd != -1);*/
val = chdir ("/tmp"); val = chdir ("/tmp");
assert (val != -1); assert (val != -1);
test_path ("movie.ogg", "file:///tmp/movie.ogg");
test_path (".", "file:///tmp/."); char buf[256];
test_path ("", "file:///tmp/"); char * tmpdir;
tmpdir = getcwd(buf, sizeof(buf)/sizeof(*buf));
assert (tmpdir);
test_current_directory_path ("movie.ogg", tmpdir, "movie.ogg");
test_current_directory_path (".", tmpdir, ".");
test_current_directory_path ("", tmpdir, "");
/*val = fchdir (fd); /*val = fchdir (fd);
assert (val != -1);*/ assert (val != -1);*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment