diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-01-31 23:40:20 -0500 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-02-01 19:47:42 -0500 |
commit | 7169562133632e11fb4f564211a1db1aa61bab5c (patch) | |
tree | 5046869e9d49e1178a18897a10feb8859833814c /tests | |
parent | 3209fdf04bdff42033e1f833913c394adcaa2e67 (diff) | |
download | gobject-introspection-7169562133632e11fb4f564211a1db1aa61bab5c.tar.gz |
doctool: Initial import of a Gjs language that we support
Copy/pasted from Python.
Diffstat (limited to 'tests')
13 files changed, 546 insertions, 2 deletions
diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Callback.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Callback.page new file mode 100644 index 00000000..98d30f8c --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Callback.page @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<page id="DocExamples.Callback" + type="topic" + style="default" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index"/> + + </info> + <title>DocExamples.Callback</title> + + + + + + + + + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Enum.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Enum.page new file mode 100644 index 00000000..79ea6370 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Enum.page @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<page id="DocExamples.Enum" + type="topic" + style="enum" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index"/> + + </info> + <title>DocExamples.Enum</title> + + + + <p>This is an example to document an enumeration.</p> + + + + +<dl> +<dt><p>Enum.FOO :</p></dt> +<dd><p>a foo</p></dd> +<dt><p>Enum.BAR :</p></dt> +<dd><p>a bar</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-property-example.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-property-example.page new file mode 100644 index 00000000..398fc4cc --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-property-example.page @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj-property-example" + type="topic" + style="property" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="DocExamples.Obj" group="property"/> + <title type="link" role="topic">property-example</title> + + </info> + <title>DocExamples.Obj:property-example</title> + +<synopsis><code mime="text/x-python"> +"property-example" {String: gint8} : Read / Write +</code></synopsis> + + + <p>This is an example of how to document a property.</p> + + + <p>Since 0.99</p> + + + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-signal-example.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-signal-example.page new file mode 100644 index 00000000..8b7e5d5d --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-signal-example.page @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj-signal-example" + type="topic" + style="signal" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="DocExamples.Obj" group="signal"/> + <title type="link" role="topic">signal-example</title> + + </info> + <title>DocExamples.Obj::signal-example</title> + +<synopsis><code mime="text/x-python"> +def callback(obj, int_param, float_param, pointer_param, user_param1, ...) +</code></synopsis> + + + <p>This is an example of how to document a signal.</p> + + + <p>Since 0.99</p> + + +<dl> +<dt><p>obj :</p></dt> +<dd><p>instance of DocExamples.Obj that is emitting the signal</p></dd> +<dt><p>int_param :</p></dt> +<dd><p>a parameter of type int</p></dd> +<dt><p>float_param :</p></dt> +<dd><p>a parameter of type float</p></dd> +<dt><p>pointer_param :</p></dt> +<dd><p>A pointer to @obj's thingy -- pass <code>int_param</code> if you really want to.</p></dd> +<dt><p>user_param1 :</p></dt> +<dd><p>first user parameter (if any) specified with the connect() method</p></dd> +<dt><p>... :</p></dt> +<dd><p>additional user parameters (if any)</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-vfunc.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-vfunc.page new file mode 100644 index 00000000..bd876ca8 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj-vfunc.page @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj-vfunc" + type="topic" + style="vfunc" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index"/> + + </info> + <title>DocExamples.Obj::vfunc</title> + +<synopsis><code mime="text/x-python"> +@accepts(Number) +@returns(none) +def do_vfunc(self, first_arg): +</code></synopsis> + + + <p>This is an example of how to document a vfunc.</p> + + + <p>Since 0.99</p> + + +<dl> +<dt><p>first_arg :</p></dt> +<dd><p>first argument</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page new file mode 100644 index 00000000..4e049123 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.method.page @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj.method" + type="topic" + style="method" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="DocExamples.Obj" group="method"/> + <api:function> + <api:returns> + <api:type>Boolean</api:type> + </api:returns> + <api:name>doc_examples_obj_method</api:name> + <api:arg> + <api:type>DocExamplesObj *</api:type> + <api:name>self</api:name> + </api:arg> + <api:arg> + <api:type>Number</api:type> + <api:name>first_arg</api:name> + </api:arg> + <api:arg> + <api:type>Number</api:type> + <api:name>second_arg</api:name> + </api:arg> + <api:arg> + <api:type>Boolean</api:type> + <api:name>boolean_arg</api:name> + </api:arg> + <api:arg> + <api:type>gpointer</api:type> + <api:name>pointer_arg</api:name> + </api:arg> + <api:arg> + <api:type>String</api:type> + <api:name>string</api:name> + </api:arg> + </api:function> + + </info> + <title>Obj.prototype.method</title> + +<synopsis><code mime="text/x-python"> +@accepts(Number, Number, Boolean, gpointer, String) +@returns(Boolean) +def method(self, first_arg, second_arg, boolean_arg, pointer_arg, string): + # Python wrapper for doc_examples_obj_method() +</code></synopsis> + + + <p>This is an example of how to document a method.</p><p>You should call this on a <link xref="DocExamples.Obj"/> that was +created with <link xref="DocExamples.Obj.new"/>.</p><p>This should be a %FALSEALARM.</p> + + + <p>Since 0.99</p> + + +<dl> +<dt><p>first_arg :</p></dt> +<dd><p>A <link xref="DocExamples.Obj"/>.</p></dd> +<dt><p>second_arg :</p></dt> +<dd><p>second argument</p></dd> +<dt><p>boolean_arg :</p></dt> +<dd><p>You should always pass <code>true</code>.</p></dd> +<dt><p>pointer_arg :</p></dt> +<dd><p>If not <code>null</code>, do a thing. Pass <code>first_arg</code> if you want to sometimes. You can also pass <code>second_arg</code>, or even <code>boolean_arg</code>.</p></dd> +<dt><p>string :</p></dt> +<dd><p>A NUL-terminated string.</p></dd> +<dt><p>Returns :</p></dt> +<dd><p>Either <code>false</code> or something <code>false</code>-y.</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.new.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.new.page new file mode 100644 index 00000000..16dbd65a --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.new.page @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj.new" + type="topic" + style="constructor" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="DocExamples.Obj" group="constructor"/> + <api:function> + <api:returns> + <api:type>DocExamples.Obj</api:type> + </api:returns> + <api:name>doc_examples_obj_new</api:name> + </api:function> + + </info> + <title>Obj.new</title> + +<synopsis><code mime="text/x-python"> +@returns(DocExamples.Obj) +def new(): + # Python wrapper for doc_examples_obj_new() +</code></synopsis> + + + + + + + +<dl> +<dt><p>Returns :</p></dt> +<dd></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.page new file mode 100644 index 00000000..c040d0e3 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.page @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj" + type="guide" + style="class" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index"/> + + </info> + <title>DocExamples.Obj</title> + + <synopsis><code> +from gi.repository import DocExamples + +obj = DocExamples.Obj(<link xref='DocExamples.Obj-property-example'>property_example</link>=value) </code></synopsis> + + + <p>This is an example of how to document a class</p><p>This class has a signal: <link xref="DocExamples.Obj-signal-example"/>.</p><p>And also has a property: <link xref="DocExamples.Obj-property-example"/>.</p> + + + <p>Since 0.99</p> + + + <synopsis> + <title>Hierarchy</title> + <tree> + <item> + <code>GObject.Object</code> + <item> + <code>DocExamples.Obj</code> + </item> + </item> + </tree> + </synopsis> + + + <links type="topic" ui:expanded="yes" + api:type="function" api:mime="text/x-gjs" + groups="method" style="linklist"> + <title>Methods</title> + </links> + <links type="topic" ui:expanded="yes" + api:type="function" api:mime="text/x-gjs" + groups="function" style="linklist"> + <title>Functions</title> + </links> + <links type="topic" ui:expanded="yes" groups="property" style="linklist"> + <title>Properties</title> + </links> + <links type="topic" ui:expanded="yes" groups="signal" style="linklist"> + <title>Signals</title> + </links> + <links type="topic" ui:expanded="yes" groups="vfunc" style="linklist"> + <title>Virtual functions</title> + </links> + <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist"> + <title>Other</title> + </links> + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.static_method.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.static_method.page new file mode 100644 index 00000000..6577e9b5 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.Obj.static_method.page @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<page id="DocExamples.Obj.static_method" + type="topic" + style="function" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="DocExamples.Obj" group="function"/> + <api:function> + <api:returns> + <api:type>Boolean</api:type> + </api:returns> + <api:name>doc_examples_obj_static_method</api:name> + <api:arg> + <api:type>Number</api:type> + <api:name>out_arg</api:name> + </api:arg> + </api:function> + + </info> + <title>static_method</title> + +<synopsis><code mime="text/x-python"> +@accepts(Number) +@returns(Boolean) +def static_method(out_arg): + # Python wrapper for doc_examples_obj_static_method() +</code></synopsis> + + + <p>This is an example of a function with an out argument +and a return value.</p> + + + + +<dl> +<dt><p>out_arg :</p></dt> +<dd><p>a pointer to int, or <code>null</code> to ignore</p></dd> +<dt><p>Returns :</p></dt> +<dd><p><code>true</code> if <code>out_arg</code> is valid, <code>false</code> otherwise</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.array_function.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.array_function.page new file mode 100644 index 00000000..f41047b2 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.array_function.page @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<page id="DocExamples.array_function" + type="topic" + style="function" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index" group="function"/> + <api:function> + <api:returns> + <api:type>[Number]</api:type> + </api:returns> + <api:name>doc_examples_array_function</api:name> + <api:arg> + <api:type>Number</api:type> + <api:name>out_len</api:name> + </api:arg> + </api:function> + + </info> + <title>array_function</title> + +<synopsis><code mime="text/x-python"> +@accepts(Number) +@returns([Number]) +def array_function(out_len): + # Python wrapper for doc_examples_array_function() +</code></synopsis> + + + <p>This function returns an array with an explicit length, +and the length should be invisible in most introspected bindings.</p> + + + + +<dl> +<dt><p>out_len :</p></dt> +<dd><p>the length of the returned array</p></dd> +<dt><p>Returns :</p></dt> +<dd><p>an array of numbers.</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.callback_function.page b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.callback_function.page new file mode 100644 index 00000000..9b805712 --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/DocExamples.callback_function.page @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<page id="DocExamples.callback_function" + type="topic" + style="function" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index" group="function"/> + <api:function> + <api:returns> + <api:type>DocExamples.Enum</api:type> + </api:returns> + <api:name>doc_examples_callback_function</api:name> + <api:arg> + <api:type>DocExamples.Callback</api:type> + <api:name>callback</api:name> + </api:arg> + <api:arg> + <api:type>gpointer</api:type> + <api:name>user_data</api:name> + </api:arg> + <api:arg> + <api:type>GLib.DestroyNotify</api:type> + <api:name>destroy_notify</api:name> + </api:arg> + </api:function> + + </info> + <title>callback_function</title> + +<synopsis><code mime="text/x-python"> +@accepts(DocExamples.Callback, gpointer, GLib.DestroyNotify) +@returns(DocExamples.Enum) +def callback_function(callback, user_data, destroy_notify): + # Python wrapper for doc_examples_callback_function() +</code></synopsis> + + + <p>This is a function that takes a callback. Different languages +will expose this in different ways (e.g. Python keeps the +<code>user_data</code> parameter, while JS doesn't)</p> + + + + +<dl> +<dt><p>callback :</p></dt> +<dd><p>Just Call Me Maybe</p></dd> +<dt><p>user_data :</p></dt> +<dd><p>your stuff</p></dd> +<dt><p>destroy_notify :</p></dt> +<dd><p>how to get rid of <code>user_data</code></p></dd> +<dt><p>Returns :</p></dt> +<dd><p><link xref="DocExamples.Enum"/>.foo sometimes, <link xref="DocExamples.Enum"/>.bar other times.</p></dd> +</dl> + + + +</page> diff --git a/tests/doctool/DocExamples-1.0-Gjs-expected/index.page b/tests/doctool/DocExamples-1.0-Gjs-expected/index.page new file mode 100644 index 00000000..de98563c --- /dev/null +++ b/tests/doctool/DocExamples-1.0-Gjs-expected/index.page @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<page id="index" + type="guide" + style="namespace" + xmlns="http://projectmallard.org/1.0/" + xmlns:api="http://projectmallard.org/experimental/api/" + xmlns:ui="http://projectmallard.org/experimental/ui/"> + <info> + + <link type="guide" xref="index"/> + + </info> + <title>Index</title> + + + + + + + + + + <links type="topic" ui:expanded="yes" groups="class" style="linklist"> + <title>Classes</title> + </links> + <links type="topic" ui:expanded="yes" groups="function" style="linklist"> + <title>Functions</title> + </links> + <links type="topic" ui:expanded="yes" groups="#first #default #last" style="linklist"> + <title>Other</title> + </links> + +</page> diff --git a/tests/doctool/Makefile.am b/tests/doctool/Makefile.am index 127b2585..4d2b9d7f 100644 --- a/tests/doctool/Makefile.am +++ b/tests/doctool/Makefile.am @@ -14,8 +14,8 @@ libdocexamples_la_SOURCES = $(srcdir)/doc-examples-obj.c $(srcdir)/doc-examples- GIRS = TYPELIBS = $(GIRS:.gir=.typelib) INTROSPECTION_GIRS = $(GIRS) -CHECK_TARGETS = $(GIRS:.gir=-C.page.check) $(GIRS:.gir=-Python.page.check) -MALLARD_DIRS = $(GIRS:.gir=-C) $(GIRS:.gir=-Python) +CHECK_TARGETS = $(GIRS:.gir=-C.page.check) $(GIRS:.gir=-Python.page.check) $(GIRS:.gir=-Gjs.page.check) +MALLARD_DIRS = $(GIRS:.gir=-C) $(GIRS:.gir=-Python) $(GIRS:.gir=-Gjs) EXPECTED_MALLARD_DIRS = $(MALLARD_DIRS:=-expected) CLEANFILES = $(TYPELIBS) $(GIRS) BUILT_SOURCES = $(MALLARD_DIRS) @@ -40,12 +40,21 @@ GIRS += DocExamples-1.0.gir $(AM_V_at)rm -f $*-Python/*.page $(AM_V_at)$(INTROSPECTION_DOCTOOL) --language Python $*.gir -o $*-Python/ +%-Gjs: %.gir + $(AM_V_GEN) + $(AM_V_at)$(MKDIR_P) $*-Gjs + $(AM_V_at)rm -f $*-Gjs/*.page + $(AM_V_at)$(INTROSPECTION_DOCTOOL) --language Gjs $*.gir -o $*-Gjs/ + %-C.page.check: %-C @diff -u -w -B -U 10 $(srcdir)/$*-C-expected $*-C && echo " TEST $*-C" %-Python.page.check: %-Python @diff -u -w -B -U 10 $(srcdir)/$*-Python-expected $*-Python && echo " TEST $*-Python" +%-Gjs.page.check: %-Gjs + @diff -u -w -B -U 10 $(srcdir)/$*-Gjs-expected $*-Gjs && echo " TEST $*-Gjs" + check-local: $(CHECK_TARGETS) $(TYPELIBS) clean-local: @rm -rf $(MALLARD_DIRS) |