summaryrefslogtreecommitdiff
path: root/tests/scanner/regress.c
Commit message (Collapse)AuthorAgeFilesLines
* Add additional fundamental test.ewlsh/fundamental-testEvan Welsh2020-10-061-1/+9
| | | | Necessary as there is currently no Regress function to test whether functions can accept fundamental parameters.
* Revert "Add support for element-type to GListModel"Rico Tzschichholz2020-04-281-30/+0
| | | | | | Breaks vapigen and changes GListModel definition in Gio-2.0.gir This reverts commit a9f45431684e6be3623e272e54d481e4c5d9423d.
* Add support for element-type to GListModelEmmanuele Bassi2020-04-261-0/+30
| | | | | | | | GListModel is an interface for creating typed, list-like containers. The data stored is GObject instances, but it's useful to be able to annotate the actual type, for both documentation and code generation purposes. The annotation should be optional, to maintain backward compatibility.
* Revert "Add element-type support to GListModel"Emmanuele Bassi2020-04-261-30/+0
| | | | | | This reverts commit b4c058bba4d95ae10e1e4238f9417fe954f97795. See: #336
* Add element-type support to GListModelEmmanuele Bassi2020-04-241-0/+30
| | | | | | | | GListModel is an interface for creating typed, list-like containers. The data stored is GObject instances, but it's useful to be able to annotate the actual type, for both documentation and code generation purposes. Fixes: #328
* Support array arguments with static keywordEmmanuele Bassi2019-09-151-0/+16
| | | | | | | | | | | | | | | | | | | | | | | C99 allows defining an array argument with a fixed size as: void foo (int arr[static 10]) Compilers conforming to the C99 specification will be able to warn if the function is called with NULL or with an array smaller than the specified length, something that does not happen when using pre-C99 declarations like: void foo (int arr[10]) As the declaration above is identical to: void foo (int arr[]) Which is, in turn, identical to: void foo (int *arr) Fixes: #309
* regress: Add regression test for signal with GError paramPhilip Chimento2019-08-011-0/+44
| | | | | | | | This exercises the little-used code path where a signal is emitted with a nullable GError as a parameter. It's modeled after GstPbutils.Discoverer's 'discovered' signal. See GNOME/gjs#262.
* regress: Check array length before accessingPhilip Chimento2019-04-151-1/+7
|
* regress: Initialize all struct fields, or mark intent not toPhilip Chimento2019-04-151-4/+4
| | | | | | | In some cases we don't initialize all the struct fields of Regress structs. We should either initialize them all, in the case of fields that were added later; or mark that we don't intend to initialize them all, by using C99 designated initializers.
* tests: Mark unused function arguments with G_GNUC_UNUSEDPhilip Chimento2019-04-151-53/+59
| | | | | | | These files are exported for other projects to compile, so they should compile with as few compiler warnings as possible. If GJS or PyGObject has -Wunused-parameter turned on, then there should not be warnings in these files.
* tests: Add functions using flat struct arraysTomasz Miąsko2019-01-081-0/+123
| | | | | | | | | | | | | | Relatively common in practice are: * output with transfer full, which is already covered by `regress_test_array_struct_out`, * input with transfer none, covered by a new `regress_test_array_struct_in_none` Other variants are quite esoteric, but it still might be useful to include them so that bindings can verify that they are handled gracefully, e.g., by reporting an error instead of crashing. Issue #90
* regress: Implement interface and override propertiesPhilip Chimento2018-11-071-1/+79
| | | | | | | | This adds a property to RegressTestInterface which can be overridden, and makes RegressTestSubObj implement it and override the property. This is in order to catch the regressions in GJS around property access. See gjs#193.
* regress: Add test for write-only propertyPhilip Chimento2018-10-221-0/+14
| | | | | | | GTK contains a few write-only properties, so it makes sense to have one in the regress test suite. See gjs!246
* regress: implement the getter/setter for the new byte-array property.Christoph Reiter2018-08-111-0/+8
| | | | | It was added as part of !25 but without any implementation. This made instantiating TestObject fail which we do in the pygobject test suite.
* build: enable -Wcast-function-typeChristoph Reiter2018-07-291-1/+1
| | | | | | | | Where it's easy add dummy args to match the cast; where the target is a subset just prevent the warning with a cast to void*. Provide a real copy function for the boxed type code in regress_foo. This code is never executed afaics, but why not.
* regress: Don't leak in property setter and destructorSimon Feltman2018-07-271-0/+10
| | | | | | | | | | | Clear the string property of RegressTestObj prior to setting within the property setter. Make sure the linked list, hash table, and string properties are cleared during destruction. This fixes trivial memory leaks found with the PyGObject test suite. https://bugzilla.gnome.org/show_bug.cgi?id=735013 Closes #113
* regress: Use g_list_free_full and g_list_copy_deepSimon Feltman2018-07-271-9/+3
| | | | | | | | Cleanup which replaces manual loop implementation with API calls when setting the linked list property. https://bugzilla.gnome.org/show_bug.cgi?id=735013 Closes #113
* regress: Avoid double-promotion warningPhilip Chimento2018-06-201-1/+1
| | | | | Float literal is silently promoted to a double here. Change it to a double literal.
* regress: Add test with signal inout parameterPhilip Chimento2018-06-201-0/+36
| | | | | | | This is modeled after GtkEditable::insert-text which isn't marshalled properly in GJS. See gjs#147.
* regress: Add test for interface signalPhilip Chimento2018-06-201-0/+25
| | | | | | | It includes a pointer parameter; for some reason, the pointer parameter breaks g_object_info_find_signal() but a parameter-less signal doesn't. See gjs#147.
* Add regression tests for default ByteArray element type.Tomasz Miąsko2018-04-151-1/+14
|
* tests: Fix declarationsPhilip Chimento2018-03-311-5/+6
| | | | Otherwise these will warn.
* tests: Avoid global variable shadowing localPhilip Chimento2018-03-311-5/+5
| | | | This will otherwise warn.
* tests: Fix const-ness warningsPhilip Chimento2018-03-311-6/+8
| | | | | Compiling these gives warnings about const or non-const expressions. Fix it by using the correct const-ness of types.
* Fix parsing when type_specifier comes before type_qualifier.Tomasz Miąsko2018-02-091-1/+1
| | | | | | | | | | | | | | | | If type_specifier comes after type_qualifier, then GISourceType representing type_specifier will be merely updated with qualifier flags. On the other hand, when this order is reversed the type qualifier used to be attached as a separate node through base_type (with CTYPE_INVALID), and interpreted incorrectly in transformer code. This commit changes this behaviour so that information about type qualifiers is stored directly in GISourceType corresponding to type specifier. It also fixes analogous issue with storage_class_specifier and function_specifier. From higher level viewpoint, it for example represents `const char*` and `char const*` in equivalent manner after parsing, and addresses issue #79.
* regress: Check that enum value assignments work for all membersEmmanuele Bassi2018-01-251-0/+1
| | | | | | | Value assignments can happen at any point in the enumeration declaration. https://bugzilla.gnome.org/show_bug.cgi?id=629667
* regress: Test for property and method with conflicting namesRico Tzschichholz2017-07-211-1/+33
| | | | | | | | | | This is something that libraries are not supposed to do, but some do anyway (Soup and Clutter are two examples) and language bindings should handle it somehow or other. In GJS we want to make sure that the way it's handled doesn't change inadvertently, because buggy library code should not break existing user code. https://bugzilla.gnome.org/show_bug.cgi?id=785091
* regress: Add test for setting a NULL strv in a GValueSam Spilsbury2017-04-251-0/+17
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=775679
* tests: Add a hidden fundamental classLionel Landwerlin2017-01-141-0/+37
| | | | | | | We could have a fundamental type A derived by a subclass B. Class A happens to be introspected, but B isn't. This can cause some issues in Gjs. https://bugzilla.gnome.org/show_bug.cgi?id=760056
* tests: Add regression test for signal w. array+lenPhilip Chimento2016-02-081-1/+13
| | | | | | | | This is a regression test for marshalling callback arguments from signals with an array parameter and separate length parameter into closures in the introspected language. https://bugzilla.gnome.org/show_bug.cgi?id=761659
* tests: Add regression test for out array of structPhilip Chimento2016-02-071-0/+17
| | | | | | | This is a regression test for returning out arrays of structs, like gdk_keymap_get_entries_for_keyval() for example. https://bugzilla.gnome.org/show_bug.cgi?id=761658
* tests: Add more regression tests for (not nullable)Philip Withnall2015-11-061-0/+24
| | | | | | | | | | | | On bug #719966, the question arose of whether parameters annotated with (element-type) but not (not nullable) are regarded as nullable or non-nullable. Add some new unit tests to Regress-1.0.gir to check the behaviour is as expected: annotating a parameter with (element-type) implicitly makes it non-nullable (unless also annotated with (nullable)). https://bugzilla.gnome.org/show_bug.cgi?id=757678
* tests: Usage a single allocation for test_ghash_gvalue_returnSimon Feltman2015-10-191-22/+26
| | | | | | | | Use a single static allocation for the hash created in regress_test_ghash_gvalue_return(). This function is explicitly marked as returning the hash with transfer-none and doesn't need to re-create the hash each call. https://bugzilla.gnome.org/show_bug.cgi?id=736517
* tests: Free input array in test_array_int_inout()Simon Feltman2015-10-191-0/+2
| | | | | | Transfer is annotated as full so the function should free its input. https://bugzilla.gnome.org/show_bug.cgi?id=736517
* tests: Free input string in regress_test_utf8_inout()Simon Feltman2015-10-191-0/+1
| | | | | | | Transfer is annotated as full so the function should free its input after testing and before output assignment. https://bugzilla.gnome.org/show_bug.cgi?id=736517
* tests: Unref async result after adding to idle callbackSimon Feltman2015-10-191-0/+1
| | | | | | | | g_simple_async_result_complete_in_idle() will add its own reference for managing the async result. We need to unref the result after calling this so we don't leak. https://bugzilla.gnome.org/show_bug.cgi?id=736517
* Add support for function typedefs without pointerBen Iofel2015-10-191-0/+14
| | | | | | | | | | g-ir-scanner now supports something like this: typedef void my_callback(int); Notice how my_callback is not a pointer. https://bugzilla.gnome.org/show_bug.cgi?id=755645
* giscanner: Mark gpointer nodes as nullable by defaultPhilip Withnall2015-10-041-0/+1
| | | | | | | | | | | | | gpointer parameters and return types should be marked as nullable by default, unless: • also annotated with (type) and not with (nullable); or • explicitly annotated with (not nullable). This introduces the (not nullable) annotation as a direct opposite to (nullable). In future, (not) could be extended to invert other annotations. https://bugzilla.gnome.org/show_bug.cgi?id=729660
* scanner: Fix allow-none on return valuesGarrett Regier2015-09-291-0/+24
| | | | | | | | The optional annotation was being applied which is invalid for return values. https://bugzilla.gnome.org/show_bug.cgi?id=752029 Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
* scanner: GVariants are also valid to be floatingColin Walters2015-09-281-0/+11
| | | | More followup to https://bugzilla.gnome.org/show_bug.cgi?id=752047
* regress: Add a test for (nullable)Colin Walters2015-09-031-0/+9
| | | | Related to: https://bugzilla.gnome.org/719966
* test: Add a test for GList containing GType.Christoph Reiter2015-07-051-0/+18
| | | | | | See https://bugzilla.gnome.org/show_bug.cgi?id=749696 https://bugzilla.gnome.org/show_bug.cgi?id=751978
* Add deprecation guards for GSimpleAsyncResult deprecationChristoph Reiter2015-06-191-0/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=751150
* tests: Add regression test for (transfer full) returning callbacksDebarshi Ray2015-06-181-0/+14
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=750286
* Don't unconditionally include config.h in regress.cMatthias Clasen2014-10-101-0/+3
| | | | | | | This is an installed file, so we can't assume that config.h will be around. https://bugzilla.gnome.org/show_bug.cgi?id=737275
* scanner: Honor nested types on array declarations as wellColin Walters2014-09-051-0/+12
| | | | | | | | | We have special code to look at (type GLib.List(utf8)), but (type GLib.PtrArray(utf8)) didn't work. This allows NetworkManager to annotate the ActiveConnections property. https://bugzilla.gnome.org/show_bug.cgi?id=733879
* tests/scanner: Decorate Symbols for ExportChun-wei Fan2014-08-151-0/+2
| | | | | | | | | | This updates the test headers and sources to decorate the symbols with the macro that can be used to export the symbols, and include config.h first in the c-sources so that the macro can be defined with the compiler directive to export the symbols. Update the CFLAGS as well so that the header that defines the export decoration macro can be found. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* tests: Add regression test for callbacks with an inout arrayGarrett Regier2014-08-071-0/+31
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=702508
* Parse and expose ownership transfer for instance parametersGiovanni Campagna2014-07-031-0/+11
| | | | | | | | | | | Knowing the ownership transfer for instance parameters is necessary for correct memory management of functions which "eat" their instance argument, such as g_dbus_method_invocation_return_*. Parse this information from the gir file and store in the typelib, and then provide new API on GICallableInfo to retrieve this. https://bugzilla.gnome.org/show_bug.cgi?id=729662
* Revert "giscanner: don't accept (allow-none) on Returns:"Ryan Lortie2014-05-061-1/+1
| | | | | | | This reverts commit 0839e696e9fbc1942ac5c61054de3b47e9578152. This was accidentally picked up by my 'git bz apply' against the bug as I was getting ready to push the last set of changes.