[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-dev] [Patch] test_util.c with MSVC
The src/test/test_util.c doesn't compile with MSVC (CL ver. 16.00.30319.01).
It doesn't like the "#ifdef 0" construct, but the whole chunk should be
enabled with some modifications IMHO.
'path_is_relative()' doesn't handle the "http:\\dir" case though. Why should
it? Besides 'expand_filename()' isn't for Windows. I suggest this patch:
--- Git-latest\src\test\test_util.c Fri Apr 06 22:45:14 2012
+++ src\test\test_util.c Thu Apr 26 08:59:18 2012
@@ -1526,10 +1526,6 @@
/* Windows */
#ifdef MS_WINDOWS
- /* I don't have Windows so I can't test this, hence the "#ifdef
- 0". These are tests that look useful, so please try to get them
- running and uncomment if it all works as it should */
-#ifdef 0
test_eq(1, path_is_relative("dir"));
test_eq(1, path_is_relative("dir\\"));
test_eq(1, path_is_relative("dir\\a:"));
@@ -1538,8 +1534,7 @@
test_eq(0, path_is_relative("\\dir"));
test_eq(0, path_is_relative("a:\\dir"));
test_eq(0, path_is_relative("z:\\dir"));
- test_eq(0, path_is_relative("http:\\dir"));
-#endif
+ test_eq(1, path_is_relative("http:\\dir")); /* path_is_relative() doesn't test for such */
#endif
done:
@@ -2887,7 +2882,9 @@
UTIL_LEGACY(config_line_quotes),
UTIL_LEGACY(config_line_comment_character),
UTIL_LEGACY(config_line_escaped_content),
+#ifndef MS_WINDOWS
UTIL_LEGACY(expand_filename),
+#endif
UTIL_LEGACY(strmisc),
UTIL_LEGACY(pow2),
UTIL_LEGACY(gzip),
With the above, test/test.exe now says:
util/path_is_relative: OK
--gv
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev