[gtk-doc] scan: move 3 tests for inline functions to unit tests
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] scan: move 3 tests for inline functions to unit tests
- Date: Tue, 18 Dec 2018 07:15:49 +0000 (UTC)
commit d07562d700a42fa53471a2296fb307ae05420a57
Author: Stefan Sauer <ensonic users sf net>
Date: Tue Dec 18 07:38:41 2018 +0100
scan: move 3 tests for inline functions to unit tests
tests/bugs/docs/tester-sections.txt | 4 ----
tests/bugs/src/tester.h | 42 -------------------------------------
tests/scan.py | 29 +++++++++++++++++++++++++
3 files changed, 29 insertions(+), 46 deletions(-)
---
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index c867e5b..05dda6e 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -21,13 +21,10 @@ bug_445693
bug_460127
bug_471014
bug_477532
-bug_481811
bug_501038
bug_512155a_function_pointer_t
bug_512155b_function_pointer_t
bug_512155c_function_pointer_t
-bug_532395a
-bug_532395b
bug_554833
bug_574654a
bug_574654b
@@ -70,4 +67,3 @@ BUG_711598_DEPRECATED_FOR
bug_554833_new
G_GNUC_NONNULL
</SECTION>
-
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 46c361d..c6b154e 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -4,19 +4,6 @@
#include <glib.h>
-/**
- * bug_481811:
- * @x: argument
- *
- * http://bugzilla.gnome.org/show_bug.cgi?id=481811
- **/
-static inline double
-bug_481811(double x)
-{
- return g_random_double_range(x,x*x);
-}
-
-
/**
* bug_501038:
* @a: value
@@ -141,35 +128,6 @@ typedef int (*bug_512155c_function_pointer_t) (unsigned int arg1,
#define BUG_530758 "dummy"
-/**
- * bug_532395a:
- * @number: a number
- *
- * http://bugzilla.gnome.org/show_bug.cgi?id=532395
- *
- * Returns: number
- */
-/**
- * bug_532395b:
- *
- * http://bugzilla.gnome.org/show_bug.cgi?id=532395
- */
-G_INLINE_FUNC guint
-bug_532395a (gulong number)
-{
-#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
- return G_LIKELY (number) ?
- ((GLIB_SIZEOF_LONG * 8 - 1) ^ __builtin_clzl(number)) + 1 : 1;
-#else
- return 0;
-#endif
-}
-G_INLINE_FUNC void
-bug_532395b (void)
-{
-}
-
-
/**
* bug_554833:
* @i: value;
diff --git a/tests/scan.py b/tests/scan.py
index 62a6f60..a227c2e 100755
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -262,6 +262,35 @@ class ScanHeaderContentFunctions(ScanHeaderContentTestCase):
header.splitlines(keepends=True))
self.assertDecl('func', 'void', 'int a', slist)
+ @parameterized.expand([('g_inline', 'G_INLINE_FUNC'), ('static_inline', 'static inline')])
+ def test_FindsInlineFunction(self, _, modifier):
+ header = textwrap.dedent("""\
+ %s void
+ func (void)
+ {
+ }
+ """ % modifier)
+ slist, doc_comments = self.scanHeaderContent(
+ header.splitlines(keepends=True))
+ self.assertDecl('func', 'void', 'void', slist)
+
+ @parameterized.expand([('g_inline', 'G_INLINE_FUNC'), ('static_inline', 'static inline')])
+ def test_FindsInlineFunctionWithConditionalBody(self, _, modifier):
+ header = textwrap.dedent("""\
+ %s int
+ func (int a)
+ {
+ #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
+ return a;
+ #else
+ return 0;
+ #endif
+ }
+ """ % modifier)
+ slist, doc_comments = self.scanHeaderContent(
+ header.splitlines(keepends=True))
+ self.assertDecl('func', 'int', 'int a', slist)
+
class ScanHeaderContentMacros(ScanHeaderContentTestCase):
"""Test parsing of macro declarations."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]