[gobject-introspection] tests: add regression test for anonymous struct
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: add regression test for anonymous struct
- Date: Sun, 8 May 2016 22:04:15 +0000 (UTC)
commit 3474d20fe8716608b1156701fdb043add10ebb7d
Author: Scott D Phillips <scott d phillips intel com>
Date: Wed May 4 17:22:05 2016 -0700
tests: add regression test for anonymous struct
C11 which added support for anonymous unions (already supported)
also adds support for anonymous structs.
https://bugzilla.gnome.org/show_bug.cgi?id=766011
.../Regress.AnonymousUnionAndStruct-None.page | 14 +++++++
.../Regress.AnonymousUnionAndStruct-x.page | 14 +++++++
.../Regress.AnonymousUnionAndStruct.page | 35 ++++++++++++++++
.../Regress.AnonymousUnionAndStruct-x.page | 18 ++++++++
.../Regress.AnonymousUnionAndStruct.page | 42 ++++++++++++++++++++
.../Regress.AnonymousUnionAndStruct-None.page | 14 +++++++
.../Regress.AnonymousUnionAndStruct-x.page | 14 +++++++
.../Regress.AnonymousUnionAndStruct.page | 40 +++++++++++++++++++
tests/scanner/Regress-1.0-expected.gir | 22 ++++++++++
tests/scanner/regress.h | 13 ++++++
10 files changed, 226 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-None.page
b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-None.page
new file mode 100644
index 0000000..45f06a9
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-None.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct-None"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnonymousUnionAndStruct" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct->None</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-x.page
b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-x.page
new file mode 100644
index 0000000..1f2f8f0
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct-x.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct-x"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnonymousUnionAndStruct" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct->x</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct.page
b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct.page
new file mode 100644
index 0000000..e9b8ae7
--- /dev/null
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.AnonymousUnionAndStruct.page
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct</title>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-csrc"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct-x.page
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct-x.page
new file mode 100644
index 0000000..44f120a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct-x.page
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct-x"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnonymousUnionAndStruct" group="field" type="guide"/>
+ <title type="link" role="topic">x</title>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct.x</title>
+ <synopsis><code mime="text/x-gjs">
+AnonymousUnionAndStruct.x: Number(gint) (Read / Write)
+ </code></synopsis>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct.page
b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct.page
new file mode 100644
index 0000000..915dd53
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Gjs-expected/Regress.AnonymousUnionAndStruct.page
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct</title>
+ <synopsis><code>
+const Regress = imports.gi.Regress;
+
+let anonymousUnionAndStruct = new Regress.AnonymousUnionAndStruct({
+ <link xref='Regress.AnonymousUnionAndStruct-x'>x</link>: value
+});
+ </code></synopsis>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/x-gjs"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-None.page
b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-None.page
new file mode 100644
index 0000000..45f06a9
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-None.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct-None"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnonymousUnionAndStruct" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct->None</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-x.page
b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-x.page
new file mode 100644
index 0000000..1f2f8f0
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct-x.page
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct-x"
+ type="topic"
+ style="field"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="Regress.AnonymousUnionAndStruct" group="field" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct->x</title>
+
+
+</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct.page
b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct.page
new file mode 100644
index 0000000..1dab19a
--- /dev/null
+++ b/tests/scanner/Regress-1.0-Python-expected/Regress.AnonymousUnionAndStruct.page
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<page id="Regress.AnonymousUnionAndStruct"
+ type="guide"
+ style="class"
+ xmlns="http://projectmallard.org/1.0/"
+ xmlns:api="http://projectmallard.org/experimental/api/"
+ xmlns:ui="http://projectmallard.org/1.0/ui/">
+ <info>
+ <link xref="index" group="class" type="guide"/>
+ </info>
+ <title>Regress.AnonymousUnionAndStruct</title>
+ <synopsis><code>
+from gi.repository import Regress
+
+anonymous_union_and_struct = Regress.AnonymousUnionAndStruct()
+ </code></synopsis>
+
+
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="constructor" style="linklist">
+ <title>Constructors</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="method" style="linklist">
+ <title>Methods</title>
+ </links>
+ <links type="topic" ui:expanded="true"
+ api:type="function" api:mime="text/python"
+ groups="function" style="linklist">
+ <title>Static Functions</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="field" style="linklist">
+ <title>Fields</title>
+ </links>
+ <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
+ <title>Other</title>
+ </links>
+</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 658b17f..2dca2f2 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -910,6 +910,28 @@ it says it's pointer but it's actually a string.</doc>
</array>
</field>
</record>
+ <record name="AnonymousUnionAndStruct"
+ c:type="RegressAnonymousUnionAndStruct">
+ <field name="x" writable="1">
+ <type name="gint" c:type="int"/>
+ </field>
+ <union>
+ <record>
+ <field name="a" writable="1">
+ <type name="LikeGnomeKeyringPasswordSchema"
+ c:type="RegressLikeGnomeKeyringPasswordSchema*"/>
+ </field>
+ <field name="b" writable="1">
+ <type name="LikeXklConfigItem" c:type="RegressLikeXklConfigItem*"/>
+ </field>
+ </record>
+ <field name="padding" writable="1">
+ <array zero-terminated="0" c:type="guint" fixed-size="4">
+ <type name="guint" c:type="guint"/>
+ </array>
+ </field>
+ </union>
+ </record>
<constant name="BOOL_CONSTANT" value="true" c:type="REGRESS_BOOL_CONSTANT">
<type name="gboolean" c:type="gboolean"/>
</constant>
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index c110690..1abd610 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -1449,6 +1449,19 @@ typedef struct {
};
} RegressAnAnonymousUnion;
+typedef struct {
+ int x;
+
+ union {
+ struct {
+ RegressLikeGnomeKeyringPasswordSchema *a;
+ RegressLikeXklConfigItem *b;
+ };
+
+ guint padding[4];
+ };
+} RegressAnonymousUnionAndStruct;
+
GVariant *
regress_get_variant (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]