]> git.sesse.net Git - vlc/commitdiff
test: Fix url test on Mac OS X.
authorPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 May 2009 22:19:13 +0000 (15:19 -0700)
committerPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 May 2009 22:22:28 +0000 (15:22 -0700)
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

index d03e48ca6d8953c7ff0c05bb7a692ade263715d3..875c9a5f7b37a588f8fbba482e712428abe679b7 100644 (file)
@@ -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);*/