Commit Graph

102 Commits

Author SHA1 Message Date
Simon McVittie
29f2ced8eb various GLib tests: plug memory leaks
These don't really matter, since it's test code, but they do obscure
real leaks in the library.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Acked-by: Matthias Clasen <mclasen@redhat.com>
2011-12-14 12:40:16 +00:00
Simon McVittie
a0f5e89aed testglib: test_file_functions: don't close fd if it's -1
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
2011-12-14 12:40:02 +00:00
Will Thompson
5e2a2ef288 g_parse_debug_string: invert flags given besides "all"
Any flags specified as well as "all" are subtracted from the result,
allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me
debugging information for everything except bar and baz".

https://bugzilla.gnome.org/show_bug.cgi?id=642452
2011-10-24 20:35:30 -04:00
Will Thompson
73ffa9034f Test g_parse_debug_string ("all")
https://bugzilla.gnome.org/show_bug.cgi?id=642452
2011-10-24 20:26:22 -04:00
Ryan Lortie
ce9681b87e Drop a few more G_CONST_RETURN 2011-06-13 09:27:28 -04:00
Matthias Clasen
abf4a0200f Test runtime dir getter 2011-06-06 00:30:30 -04:00
Matthias Clasen
316be2748f Adapt testglib.c to GRelation deprecation
Patch by Chun-wei Fan, bug https://bugzilla.gnome.org/show_bug.cgi?id=637858
2010-12-28 00:12:19 -05:00
Tor Lillqvist
46390c9d10 Don't call close() on -1
Of course, a proper implementation of close() will just ignore an
invalid parameter silently, and set errno. But apparently the "debug"
version of the Microsoft C library generates some noise in this
case. So avoid that. Thanks to John Emmas for reporting.
2010-10-07 12:06:48 +03:00
Jens Georg
db7ddcc195 Improve parsing of date-only iso8601 strings 2010-08-26 18:18:52 +03:00
Juan A. Suarez Romero
992e07c8b2 Fix warnings
Do explicit casts to avoid warnings.
2010-06-09 10:32:12 +02:00
Tor Lillqvist
241c7f476d Don't use deprecated g_win32 API 2010-02-04 14:53:20 +02:00
Dan Winship
8212aadac7 g_time_val_from_iso8601: handle timezoneless dates
per ISO 8601:2004 4.2.5.2

Based on a patch from Andy Shevchenko
http://bugzilla.gnome.org/show_bug.cgi?id=589491
2009-09-01 09:40:03 -04:00
Peter Kjellerstedt
efc2cdbfc9 Fix parsing of timezones
Make g_time_val_from_iso8601 handle timezones with minutes correctly;
also accept comma as a fraction separator.  (#578369)
2009-04-08 10:26:11 -04:00
Matthias Clasen
88c7129340 Bug 547337 – G_DISABLE_DEPRECATED breaks tests build
2008-08-13  Matthias Clasen  <mclasen@redhat.com>

        Bug 547337 – G_DISABLE_DEPRECATED breaks tests build

        * tests/testglib.c: Protect deprecated API by ifdefs.
        Patch by Kalle Vahlman


svn path=/trunk/; revision=7353
2008-08-14 03:05:17 +00:00
Tor Lillqvist
b5b363019a Avoid warning on Win64 by using gintptr cast instead if long cast.
2008-08-04  Tor Lillqvist  <tml@novell.com>

	* tests/testglib.c: Avoid warning on Win64 by using gintptr cast
	instead if long cast.


svn path=/trunk/; revision=7304
2008-08-04 18:12:11 +00:00
Paolo Borelli
96f99d334d Bug 539770 - migrate gstrfunc unit tests to gtest
2008-06-24  Paolo Borelli  <pborelli@katamail.com>

	Bug 539770 - migrate gstrfunc unit tests to gtest

	* tests/strfunc-test.c:
	* tests/testglib.c:
	* tests/strtoll-test.c:
	* tests/strtod-test.c:
	* tests/string-test.c:
	* tests/Makefile.am:
	Removed old tests.

	* glib/tests/fileutils.c:
	* glib/tests/strfuncs.c:
	* glib/tests/Makefile.am:
	Added all the old tests migrated to the new unit test framework
	and add new unit tests for some of the functions.


svn path=/trunk/; revision=7097
2008-06-24 13:55:22 +00:00
Matthias Clasen
d780a41c37 set tv_usec to 0 rather than 1 when a fraction of a second is not
* glib/gtimer.c (g_time_val_from_iso8601): set tv_usec to 0 rather
        than 1 when a fraction of a second is not specified
        (g_time_val_from_iso8601): calculate a fraction of a second
        correctly even in case it does not happen to consist of exactly
        six digits; do not allow random data after the ISO 8601 string,
        only whitespace
        (make g_time_val_to_iso8601): support fractions of a second
        Patch by Peter Kjellerstedt

        * tests/testglib.c: Update to match


svn path=/trunk/; revision=7057
2008-06-19 04:14:25 +00:00
17:40:58 Tim Janik
d6682a1f2d fixed gstdio.h include.
2008-04-18 17:40:58  Tim Janik  <timj@imendio.com>

        * tests/testglib.c: fixed gstdio.h include.

        * tests/Makefile.am: properly list testglib.c SOURCES.



svn path=/trunk/; revision=6862
2008-04-18 15:40:38 +00:00
Matthias Clasen
fe751b255f Small test fixup
svn path=/trunk/; revision=6652
2008-03-10 15:13:29 +00:00
Matthias Clasen
11d7305d5a Don't test user directories for being non-null. (#517084, Yevgen Muntyan)
2008-02-23  Matthias Clasen  <mclasen@redhat.com>

        * tests/testglib.c: Don't test user directories for being
        non-null.  (#517084, Yevgen Muntyan)

svn path=/trunk/; revision=6562
2008-02-23 05:14:34 +00:00
Hans Breuer
1cda3c9e01 adapt to recent api changes variable declaration at the beginning of a
2007-12-09  Hans Breuer  <hans@breuer.org>

	* tests/gio-ls.c : adapt to recent api changes
	* tests/testglib.c : variable declaration at the beginning of a block
	
	(Lieven van der Heide, #503602)
	* win32-fixup.pl : process *.rc.in as well; substitute 
	LT_CURRENT_MINUS_AGE
	* glib/makefile.msc.in : alphabetic sorting of OBJECTS


svn path=/trunk/; revision=6184
2007-12-21 10:11:35 +00:00
Emmanuele Bassi
a979c0d5a2 Fix the date validation check. (#503029)
2007-12-19  Emmanuele Bassi  <ebassi@gnome.org>

	* glib/gtimer.c (g_time_val_from_iso8601): Fix the date validation
	check. (#503029)

	* tests/testglib.c (various_string_tests): Add an invalid date
	for testing the above fix.

svn path=/trunk/; revision=6160
2007-12-19 17:28:38 +00:00
16:06:11 Tim Janik
0efd85aeac split up tests and reworked code to use the new test framework.
2007-12-12 16:06:11  Tim Janik  <timj@imendio.com>

        * tests/testglib.c: split up tests and reworked code to use
        the new test framework.

        * tests/Makefile.am: added testglib to TEST_PROGS.



svn path=/trunk/; revision=6103
2007-12-12 15:09:08 +00:00
Matthias Clasen
d154485bc7 Add support for a number of special directories, as defined by the
2007-06-04  Matthias Clasen  <mclasen@redhat.com>

        Add support for a number of special directories, as
        defined by the xdg-user-dirs specification.  (#432651,
        Bastien Nocera, Emmanuele Bassi, Michael Natterer)

        * glib/glib.symbols:
        * glib/gutils.[hc]: Add the GUserDirectory enum and
        g_get_user_special_dir(), with implementations based
        on the xdg-user-dirs spec and on native interfaces
        for Win32 and Carbon.

        * configure.in: Add Carbon checks.

        * tests/tetsglib.c: Test g_get_user_special_dir().


svn path=/trunk/; revision=5528
2007-06-04 14:54:49 +00:00
Matthias Clasen
1f536d2f12 Fix an off-by-2 error in the leap year calculation. (#344905, Dan Winship)
2006-06-20  Matthias Clasen  <mclasen@redhat.com>

	* glib/gtimer.c (mktime_utc): Fix an off-by-2 error
	in the leap year calculation.  (#344905, Dan Winship)

	* tests/testglib.c (main): Change the test data for
	the g_time_val_from_iso8601 tests to expose an off-by-2
	error in the leap year calculation.
2006-06-20 16:37:43 +00:00
Emmanuele Bassi
6db9ec4070 Check for timegm.
2006-03-23  Emmanuele Bassi  <ebassi@cvs.gnome.org>

	* configure.in: Check for timegm.

	* glib/gtimer.h:
	* glib/gtimer.c:
	* glib/glib.symbols:
	* docs/reference/glib/glib-sections.txt: Added g_time_val_to_iso8601
	and g_time_val_from_iso8601, to convert a GTimeVal to and from an
	ISO 8601 encoded date.

	* tests/testglib.c: Added test cases for g_time_val_to_iso8601()
	and g_time_val_from_iso8601() functions.
2006-03-23 02:54:29 +00:00
Matthias Clasen
9e58246669 Don't read past the end of the string. (#334471, Morten Welinder)
2006-03-14  Matthias Clasen  <mclasen@redhat.com>

	* glib/gutils.c (g_parse_debug_string): Don't read past the
	end of the string.  (#334471, Morten Welinder)
2006-03-14 17:56:27 +00:00
Tor Lillqvist
b8c119f901 glib/gfileutils.c glib/gfileutils.h glib/glib.symbols Rename g_makepath()
2005-06-22  Tor Lillqvist  <tml@novell.com>

	* glib/gfileutils.c
	* glib/gfileutils.h
	* glib/glib.symbols
	* tests/testglib.c: Rename g_makepath() to g_mkdir_with_parents().
2005-06-22 18:55:33 +00:00
Tor Lillqvist
1833a93ddd New function. Creates a directory including intermediate parent
2005-06-22  Tor Lillqvist  <tml@novell.com>

	* glib/gfileutils.c (g_makepath): New function. Creates a
	directory including intermediate parent directories as
	needed. (#60509)

	* glib/gfileutils.h: Declare it.

	* glib/glib.symbols: Add it.

	* tests/testglib.c: Test it.
2005-06-22 09:43:37 +00:00
Tor Lillqvist
477989f555 New function. Returns the machine's name, or one of its names. Document
2005-06-22  Tor Lillqvist  <tml@novell.com>

	* glib/gutils.c (g_get_host_name): New function. Returns the
	machine's name, or one of its names. Document that it is
	best-effort only, and not guaranteed to be unique or anything.
	(g_get_any_init): Get the host name here. On Unix use
	gethostname(), on Windows use GetComputerName(). (#5200)

	* glib/gutils.h
	* glib/glib.symbols: Add here, too.

	* tests/testglib.c: Test it.
2005-06-22 08:54:28 +00:00
Tor Lillqvist
446c1f1aa8 Minor printout change, now identical as in glib-2-6 branch. 2005-03-20 20:08:23 +00:00
Tor Lillqvist
20378332ae Print more detailled output from the timer tests. Don't print home
2005-03-20  Tor Lillqvist  <tml@novell.com>

	* tests/testglib.c (main): Print more detailled output from the
	timer tests. Don't print home directory twice. Test
	g_win32_error_message().

	* tests/spawn-test.c (run_tests): On Win32, run netstat instead of
	ipconfig. On Windows XP collecting output from ipconfig doesn't
	seem to work for some reason.
2005-03-20 10:43:38 +00:00
Matthias Clasen
d209e108b1 Add a function to return a list of applicable locale names. (#95587,
2004-09-07  Matthias Clasen  <mclasen@redhat.com>

	* glib/gutils.h:
	* glib/gutils.c (g_get_language_names): Add a function to
	return a list of applicable locale names.  (#95587,
	Hidetoshi Tajima)
	(guess_category_value, compute_locale_variants):
	(explode_locale, unalias_lang, read_aliases): Helper
	functions for g_get_language_names()

	* tests/testglib.c (main): Show the results of
	g_get_language_names()
2004-09-07 18:37:10 +00:00
Tor Lillqvist
b359dbbf5e Test the new XDG basedir functions.
2004-08-26  Tor Lillqvist  <tml@iki.fi>

	* tests/testglib.c (main): Test the new XDG basedir functions.
2004-08-26 00:08:46 +00:00
Matthias Clasen
48deca6379 Trivial warning fix.
2004-04-22  Matthias Clasen  <mclasen@redhat.com>

	* tests/testglib.c (main): Trivial warning fix.
2004-04-22 20:58:37 +00:00
Matthias Clasen
05501852ec Add testcases for g_message() involving non-printable and unsafe
2004-04-22  Matthias Clasen  <mclasen@redhat.com>

	* tests/testglib.c (main): Add testcases for g_message() involving
	non-printable and unsafe characters.

	* glib/gmessages.c (escape_string): Don't assume that
	string->str remains unchanged over g_string_insert()
	calls.  (#139030, Christophe Saout)
2004-04-22 20:17:54 +00:00
Tim Janik
ee4e622d37 applied patch from #131937 with slight renames. provides
Fri Feb 20 03:02:05 2004  Tim Janik  <timj@gtk.org>

        * glib/ghash.[hc]: applied patch from #131937 with slight
        renames. provides g_hash_table_find().
2004-02-20 02:05:36 +00:00
Owen Taylor
7ace455394 Add g_timer_continue(). (#98536, Tim-Philipp Müller)
Thu Jan 22 13:55:44 2004  Owen Taylor  <otaylor@redhat.com>

        * glib/gtimer.c: Add g_timer_continue().
        (#98536, Tim-Philipp Müller)

        * configure.in: Version 2.3.2, interface age 0.

        * NEWS: tweak, finish.
2004-01-22 19:56:28 +00:00
Manish Singh
b5ae75aa4a Added G_GSIZE_FORMAT and friends.
Thu Nov 20 15:09:40 2003  Manish Singh  <yosh@gimp.org>

        * configure.in: Added G_GSIZE_FORMAT and friends.

        * tests/printf-test.c
        * tests/testglib.c
        * tests/type-test.c: Add tests for the above.
2003-11-20 23:12:05 +00:00
Owen Taylor
dfa8c540a1 === Released 2.3.0 ===
Thu Oct 23 12:38:24 2003  Owen Taylor  <otaylor@redhat.com>

        * === Released 2.3.0 ===

        * tests/gobject/Makefile.am (dist-hook): Remove
        and extra backslash.

        * tests/gobject/Makefile.am (EXTRA_DIST): Add
        testmarshal.list.

        * glib/Makefile.am (libglib_2_0_la_SOURCES): Add
        missing gunicode-private.h.

        * tests/testglib.c (main): Fix a warning.

        * tests/gobject/ifaceinherit.c: Remove check that
        wasn't supposed to work (adding an interface already
        added to the derived class to the base class),
        fix a bug.
2003-10-23 22:42:31 +00:00
Tor Lillqvist
b514888d16 Use hardcoded name for DLL, as there is no reliable way to determine it at
2003-09-29  Tor Lillqvist  <tml@iki.fi>

	* tests/testglib.c (main): Use hardcoded name for DLL, as there is
	no reliable way to determine it at compile or run time anyway.
2003-09-29 22:40:40 +00:00
Tor Lillqvist
55d624d80c Fix #117925 (Dov Grobgeld):
2003-08-16  Tor Lillqvist  <tml@iki.fi>

	Fix #117925 (Dov Grobgeld):

	* glib/gutils.c (g_find_program_in_path, g_basename,
	g_path_get_basename, g_path_is_absolute, g_path_skip_root,
	g_path_get_dirname, g_get_any_init): On Win32, look also for
	slashes ('/') as pathname separators.

	* glib/gfileutils.c (g_file_open_tmp): Ditto. If the template
	contains a pathname separator, include the actual one in the error
	message, instead of always the canonical one.

	(g_build_filename): Separate implementation on Win32 that looks
	for either slash or backslash. Document Unix/Windows differences.

	* tests/testglib.c
	* tests/strfunc-test.c: Test above functionality on Win32.
2003-08-16 19:45:25 +00:00
Manish Singh
96670b2085 pull in trio if host printf doesn't have a known way of printing 64-bit
Thu Dec 12 14:58:55 2002  Manish Singh  <yosh@gimp.org>

        * configure.in: pull in trio if host printf doesn't have a known
        way of printing 64-bit ints.

        * glib/gmacros.h: remove extra whitespace at the end

        * glib/gscanner.c (g_scanner_unexp_token): use G_GUINT64_FORMAT
        instead of hardcoding "%llu"

        * tests/testglib.c: remove obsolete conditionals using G_HAVE_GINT64,
        we always have it now.

        * tests/type-test.c: same as above, and for G_G[U]INT64_FORMAT as
        well.
2002-12-12 22:59:55 +00:00
Manish Singh
d1f37d5053 add -DG_DISABLED_DEPRECATED
Tue Oct 15 15:07:45 2002  Manish Singh  <yosh@gimp.org>

        * gmodule/Makefile.am gobject/Makefile.am gthread/Makefile.am:
        add -DG_DISABLED_DEPRECATED

        * tests/gio-test.c tests/mainloop-test.c tests/string-test.c
        tests/testglib.c test/tree-test.c tests/unicode-collate.c
        tests/unicode-normalize.c: Deprecation cleanup
2002-10-15 22:16:57 +00:00
Owen Taylor
90d93042c2 Remove warning about g_print, etc, encoding.
Thu Mar 28 18:22:53 2002  Owen Taylor  <otaylor@redhat.com>

        * README: Remove warning about g_print, etc, encoding.

        * NEWS: Updates.

        * glib/gmessages.c (g_log_default_handler): Use %lu
        (plus a cast) when printing out pid_t arguments.
        (#76770, Morten Welinder)

        * glib/gstrfuncs.c (g_strdup_vprintf): Check the
        result of vasprintf(), return NULL on failure.
        (#76802, Akira Tagoh)

        * tests/testglib.c (TEST): Supress a warning with
        some GCC versions.
2002-03-28 23:24:23 +00:00
Tor Lillqvist
9c35df3de3 Add missing g_pattern_match_simple and g_pattern_spec_equal.
2001-10-28  Tor Lillqvist  <tml@iki.fi>

	* glib/glib.def: Add missing g_pattern_match_simple and
	g_pattern_spec_equal.

	* glib/gwin32.c (g_win32_get_package_installation_subdirectory):
	Set separator correctly.

	* glib/libcharset/config.charset (os): Match also mingw*.

	* tests/testglib.c (main): (Win32): Print the lib/locale
	subdirectory, as that is what actually gets used.
2001-10-28 21:05:03 +00:00
George Lebl
46aae08e8d cast the string size to gulong and use %lu for printing to avoid 64bit
Sat Sep 29 02:33:14 2001  George Lebl <jirka@5z.com>

	* tests/testglib.c (main): cast the string size to gulong and use %lu
	  for printing to avoid 64bit issues

	* glib/gstrfuncs.[ch] (g_ascii_strncasecmp): Change the 'n' argument
	  to gsize instead guint.
2001-09-29 09:42:20 +00:00
Tor Lillqvist
58f3fdd748 Accept also forward slashes. (But still don't accept them in the other
2001-09-20  Tor Lillqvist  <tml@iki.fi>

	* glib/gutils.c (g_path_is_absolute): (Win32:) Accept also forward
	slashes. (But still don't accept them in the other functions
	here. This is a thorny issue. Windows in fact does treat / like \
	on input (at least as local directory separators, dunno about
	server/share separators). But GLib only has the one
	G_DIR_SEPARATOR value, that apps should scan for, and use when
	building pathnames. To properly fix this would require totally
	abstracting pathnames, and don't having any path name scanning and
	building in applications at all. Fat chance.)
	(GLIB_LOCALE_DIR): Redefine only on "pure" Win32, not Cygwin. Use
	subdirectory "share\locale", as on Unix.

	* glib/gwin32.c: Don't need to define those langiage and
	sublanguage constants here, current mingw (w32api) headers have
	them.

	* glib/glib.def: Add a few missing entry points.

	* tests/testglib.c (main): Use same name for DLL as libtool does.
	Use G_DIR_SEPARATOR in g_path_get_basename tests.
2001-09-20 05:41:52 +00:00
Tim Janik
71075ee0db add simple test for g_path_get_basename().
Tue Sep 18 18:19:33 2001  Tim Janik  <timj@gtk.org>

        * tests/testglib.c: add simple test for g_path_get_basename().

        * glib/gfileutils.c (g_file_open_tmp):
        * glib/gstrfuncs.c (g_strerror): scratch erroneous usages
        of "illegal".
2001-09-18 16:33:20 +00:00
Darin Adler
3fa620d4df Add missing const. (g_strsplit): Add g_return_val_if_fail for case of
* glib/gstrfuncs.c: (g_ascii_strdown), (g_ascii_strup): Add
	missing const.
	(g_strsplit): Add g_return_val_if_fail for case of empty
	delimiter, which can result in an infinite loop otherwise.
	* glib/gstrfuncs.h: Add missing const.
	* tests/.cvsignore: Ignore a generated file.

	* tests/array-test.c:
	* tests/dirname-test.c:
	* tests/hash-test.c:
	* tests/list-test.c:
	* tests/node-test.c:
	* tests/relation-test.c:
	* tests/shell-test.c:
	* tests/slist-test.c:
	* tests/spawn-test.c:
	* tests/strfunc-test.c:
	* tests/string-test.c:
	* tests/testglib.c:
	* tests/tree-test.c:
	* tests/type-test.c:
	Add an #undef G_DISABLE_ASSERT so all tests will assert even if
	asserts are disabled inside glib itself.
2001-07-19 20:07:41 +00:00