From f9546b1492c7a07f77f5ac7887ca5aefc04b087e Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sat, 16 May 2009 15:19:13 -0700 Subject: [PATCH] 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. --- src/test/url.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/test/url.c b/src/test/url.c index d03e48ca6d..875c9a5f7b 100644 --- a/src/test/url.c +++ b/src/test/url.c @@ -66,6 +66,15 @@ static inline void test_path (const char *in, const char *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 val; @@ -114,9 +123,16 @@ int main (void) assert (fd != -1);*/ val = chdir ("/tmp"); assert (val != -1); - test_path ("movie.ogg", "file:///tmp/movie.ogg"); - test_path (".", "file:///tmp/."); - test_path ("", "file:///tmp/"); + + char buf[256]; + 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); assert (val != -1);*/ -- 2.39.2