OK, I get test to work(attached - libfm really need better documentation!). Bad
think is that it doesn't show where is problem with double slash, as it works
in this test case.
Could I push it?
Josef
Josef Reidinger write:
> Hi,
> tests is good idea. I try to create one based on glib testing framework.
> Patch is attached and if you have any question feel free to ask. Only think
> which I cannot solve and maybe you know is how to properly link it? (now it
> complain about _fm_path_init() not linked, which is quite strange for me).
> Also catching changes in code which cause relink of test doesn't work now
> (but it is not critical, just touch test file).
>
> Josef
>
>
> > Actually that part is quite problematic and sometimes causes crashes.
> > I'd like to create a unit test for fm_path_new_xxx but I don't really
> > know how to do it correctly and make the test integrated with the
> > building process. Any suggestions?
> >
> > 2010/6/10 Josef Reidinger <[email protected]>:
> > > Hi,
> > > I check where is problem with bug 3012747 [1]. And found that
> > > implementation of libfm doesn't expect more then one beginning slash in
> > > its structure. I can fix it[attachment] with resolving it same as '/' ,
> > > but I am not sure if it is correct as posix specify it as it can be
> > > implementation specific handling (that is reason why I am not commit it).
> > > Do you thing that it is expected behavior or on some posix systems is
> > > expected different behavior for path like //tmp ???
> > >
> > > Josef
> > >
> > > [1]
> > > http://sourceforge.net/tracker/?func=detail&aid=3012747&group_id=156956&atid=801864
> > > --
> > > Josef Reidinger
> > > YaST team
> > > maintainer of perl-Bootloader, YaST2-Repair, parts of webyast
> > >
> > > ------------------------------------------------------------------------------
> > > ThinkGeek and WIRED's GeekDad team up for the Ultimate
> > > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> > > lucky parental unit. See the prize list and enter to win:
> > > http://p.sf.net/sfu/thinkgeek-promo
> > > _______________________________________________
> > > Lxde-list mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/lxde-list
> > >
> > >
> >
>
>
>
--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, parts of webyast
From 9168356d32a6f7777cfb5b8e45a847f0978568f6 Mon Sep 17 00:00:00 2001
From: Josef Reidinger <[email protected]>
Date: Wed, 9 Jun 2010 19:08:39 +0200
Subject: [PATCH] add tests for double slash issue
---
Makefile.am | 4 +++-
src/Makefile.am | 19 +++++++++++++++++--
src/tests/testbasepath.c | 26 ++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 3 deletions(-)
create mode 100644 src/tests/testbasepath.c
diff --git a/Makefile.am b/Makefile.am
index 82574cf..a5aa93b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,10 @@
+include $(top_srcdir)/Makefile.decl
+
NULL=
SUBDIRS=src po data
-EXTRA_DIST = \
+EXTRA_DIST += \
libfm.pc.in \
libfm-gtk.pc.in \
$(NULL)
diff --git a/src/Makefile.am b/src/Makefile.am
index f13f20d..99f10e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/Makefile.decl
+
NULL=
AM_CPPFLAGS = \
@@ -290,7 +292,7 @@ BUILT_SOURCES= \
gtk/fm-gtk-marshal.c \
$(NULL)
-EXTRA_DIST = \
+EXTRA_DIST += \
base/fm-marshal.list \
gtk/fm-gtk-marshal.list \
demo/main-win-ui.c \
@@ -321,6 +323,17 @@ gnome_terminal_LDADD = \
$(GLIB_LIBS) \
$(NULL)
+TEST_PROGS += testbasepath
+testbasepath_SOURCES = tests/testbasepath.c
+testbasepath_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ -Werror-implicit-function-declaration \
+ $(NULL)
+testbasepath_LDADD = \
+ $(GLIB_LIBS) \
+ $(top_builddir)/src/libfm.la \
+ $(NULL)
+
# A lib to be loaede with LD_PRELOADS to override GtkFileChooserWidget
#lib_LTLIBRARIES=libfm-chooser-hack.la
@@ -332,7 +345,9 @@ gnome_terminal_LDADD = \
# -export-symbols-regex gtk
# Little program to optimize size of xml files
-noinst_PROGRAMS=xml-purge
+noinst_PROGRAMS=xml-purge $(TEST_PROGS)
xml_purge_SOURCES=xml-purge.c
xml_purge_CFLAGS=$(GIO_CFLAGS)
xml_purge_LDADD=$(GIO_LIBS)
+
+
diff --git a/src/tests/testbasepath.c b/src/tests/testbasepath.c
new file mode 100644
index 0000000..c8ecd59
--- /dev/null
+++ b/src/tests/testbasepath.c
@@ -0,0 +1,26 @@
+#include <base/fm-path.h>
+#include <fm.h>
+
+//ignore for test disabled asserts
+#ifdef G_DISABLE_ASSERT
+ #undef G_DISABLE_ASSERT
+#endif
+
+static void double_slash_test_case(void)
+{
+ FmPath* path = fm_path_new("//tmp/lest");
+ g_assert(path);
+ fm_path_unref(path);
+}
+
+int
+main (int argc, char *argv[])
+{
+ g_type_init();
+ g_test_init (&argc, &argv, NULL); // initialize test program
+ g_test_add_func ("/BasePath/Base Path New with Double Slash at beggining",
+ double_slash_test_case);
+ fm_init(NULL);
+ return g_test_run();
+}
+
--
1.7.0.3
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list