[vlc-devel] commit: test: Fix url test on Mac OS X. (Pierre d'Herbemont )
git version control
git at videolan.org
Sun May 17 00:23:20 CEST 2009
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sat May 16 15:19:13 2009 -0700| [f9546b1492c7a07f77f5ac7887ca5aefc04b087e] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f9546b1492c7a07f77f5ac7887ca5aefc04b087e
---
src/test/url.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/test/url.c b/src/test/url.c
index d03e48c..875c9a5 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);*/
More information about the vlc-devel
mailing list