summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add glib:name to enum memberMarc-André Lureau2021-06-201-28/+56
| | | | | | | This member will contain the string from the GEnumValue/GFlagsValue 'value_name' introspection dump. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* scanner: fix enum member c:identifierMarc-André Lureau2021-06-201-3/+3
| | | | | | Don't rely on runtime name, but on C header parsed symbol. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* tests/repository: Fix leak in test_constructor_return_typeDavid King2021-06-181-0/+1
| | | | | | Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
* Make test suite work with cross-related optionsJohn Ericson2021-05-233-41/+40
| | | | | | | | | | Because of skepticism I received in #224, I made this PR which keeps the testsuite and CI improvements but doesn't add any new build options. I hope this would be less controversial: - no new knobs - tests for those using existing build options - CI tests `build_introspection_data = false`
* Meson: Fix build when gobject-introspection is a subprojectXavier Claessens2021-03-251-6/+6
| | | | | meson.source_root() return the root of the main project, but in this case we want the root of the gobject-introspection (sub)project.
* tests: Update line numbers for expected Regress GIREmmanuele Bassi2021-03-121-8/+8
|
* Use g_memdup2() with newer versions of GLibEmmanuele Bassi2021-03-121-0/+20
| | | | | The g_memdup() function has been deprecated, so we should use the new g_memdup2() function if available.
* tests: Add "signals" test objectwip/carlosg/signal-testsCarlos Garnacho2021-03-032-0/+107
| | | | | | | | It is worth to test marshalling of signal arguments, add a basic (and barebones) object to add signals and emission methods to, so bindings can test the signal handlers. Related: https://gitlab.gnome.org/GNOME/gjs/-/issues/377
* Always pass an encoding to open() using text modeChristoph Reiter2020-11-073-3/+3
| | | | | | | | Otherwise we'll end up using the locale encoding. While it's usually utf-8, that's not the case on Windows. There is one place where a file with filenames is passed, not sure there so I left it and passed a explicit None.
* Revert "giscanner: Fix section matching for documentation"Mathieu Duponchelle2020-09-291-34/+0
| | | | | | | | | This reverts commit de6512b31b614567bf1800406303d1ccfb6d9455. This was causing naming conflicts when the SECTION documentation was picked over the class documentation. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/360
* girmarshalling tests: Diagnose GValue not holding enum/flagswip/smcv/test-more-flagsSimon McVittie2020-09-191-0/+4
| | | | | | | | If g_value_get_enum() or g_value_get_flags() is about to fail with a precondition check failure, we can improve diagnostics by issuing a more informative critical warning. Signed-off-by: Simon McVittie <smcv@debian.org>
* gimarshallingtests: Add more tests for flagsSimon McVittie2020-09-192-0/+30
| | | | | | | | Bindings sometimes need to handle flags and enums separately, so everything that is tested for enums should ideally be tested separately for flags. Signed-off-by: Simon McVittie <smcv@debian.org>
* tests: Add a test-case for a vfunc returning flags in different waysSimon McVittie2020-09-192-0/+44
| | | | | | | We already had a test for enums, but flags are not precisely the same, so testing both can give bindings better coverage. Signed-off-by: Simon McVittie <smcv@debian.org>
* giscanner: Fix section matching for documentationJames Westman2020-09-071-0/+34
| | | | | | | | | | | | | When writing documentation to the GIR files, GIR tries to match classes with their matching SECTION: comment in the source code. Some codebases use kebab-case or CamelCase for their section names, but GIR always expects them to be flatcase or the matching will fail. This commit converts all section names to flatcase (by removing "-" and converting to lowercase) while they are being parsed, so that they are matched properly later on. Fixes #350.
* Merge branch 'standalone-doc-sections' into 'master'Mathieu Duponchelle2020-07-226-26/+87
|\ | | | | | | | | Add the notion of standalone doc sections. See merge request GNOME/gobject-introspection!226
| * Add the notion of standalone doc sections.Mathieu Duponchelle2020-07-126-26/+87
| | | | | | | | | | | | | | | | Up to now, section annotations had to match a class or interface name in order to be serialized in the gir. With this commit, they now get serialized as docsection nodes, for potential use by documentation tools.
* | giscanner: parse block comments for members and fieldsMathieu Duponchelle2020-07-128-76/+155
|/ | | | | | | | | | | | | | | | | | | | | | | | | | There was previously no mechanism for tagging enum members and struct fields with Since tags (or other, eg deprecation tags). While the customary place to add Since tags for these symbols is inline in the parent symbol's documentation eg: /** * Foo: * * @FOO_BAR: some bar. Since X.Y */ And variations on that theme, implementing parsing for that scheme would result in a pretty ambiguous grammar, especially if we also want support for multiple tags. Instead, the solution implemented here is to allow providing documentation for individual members and fields through their own separate block, as is done for virtual functions already. Inline comments are still used, with a lower precedence. Fixes #348
* Meson: Fix build as subprojectXavier Claessens2020-05-064-34/+34
| | | | | meson.build_root() is the root of the main project, better use meson.current_build_dir() instead.
* Revert "Add support for element-type to GListModel"Rico Tzschichholz2020-04-2810-259/+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-2610-0/+259
| | | | | | | | 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-268-196/+0
| | | | | | This reverts commit b4c058bba4d95ae10e1e4238f9417fe954f97795. See: #336
* Revert "Generate appropriate docs for ListModel with element-type"Emmanuele Bassi2020-04-262-4/+4
| | | | | | This reverts commit ffe3e435e0b7943a0872034223b5f6ea02258ffa. See: #336
* Generate appropriate docs for ListModel with element-typeEmmanuele Bassi2020-04-242-4/+4
| | | | | | We need to special case the ListModel container type in the documentation writer so that we don't fall back into array/list automatic conversion in the code snippets.
* Add element-type support to GListModelEmmanuele Bassi2020-04-248-0/+196
| | | | | | | | 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 the gtk-doc action syntaxEmmanuele Bassi2020-04-241-1/+153
| | | | | | | | | | | | | | | | GTK4 allows adding widget-related actions to the documentation with the newly defined syntax: <class_name> '|' <action_name> ':' This means g-ir-scanner needs to detect this new format, to avoid emitting unnecessary warnings. Currently, we don't do anything with the actions; in the future we might want to add them to the documentation in the GIR, but for that we'd need a new element. See also: GNOME/gtk-doc!30
* gimarshallingtests: Use g_assert_cmpfloat_with_epsilonIain Lane2020-03-181-6/+6
| | | | Comparing floats directly doesn't always work on all architectures.
* gimarshallingtests: Add marshalling tests for virtual functions with inout ↵Marco Trevisan (Treviño)2020-03-162-0/+96
| | | | | | | | | parameters Virtual functions may use input/output parameters but this is not currently well handled by gjs, so adding test cases to gobject-introspection to verify that virtual functions correctly receive valid input values and can return them.
* Fix regress scanner testsChun-wei Fan2020-02-062-5/+5
| | | | | | | | | There is no way that non-GCC/CLang compilers will pass this test because the source position will never match the position that is in tests/scanner/Regress-1.0-expected.gir. Fix this the fast way: define a macro according to the compiler check and update the corresponding source position
* test_scanner.py: Fix path tests on WindowsChun-wei Fan2020-01-161-2/+3
| | | | | | We may get drive letters and paths either in upper or lower cases in Windows, which are actually no different. Ignore the cases in this case.
* Visual Studio builds: Use -utf-8 where availableChun-wei Fan2020-01-153-0/+14
| | | | | | | | | | | | This avoids compilation erroring out on C4819 (Unicode handling issue in the Visual Studio compiler), notably when running on Chinese, Japanese and Korean (CJK) locales. This also applies -utf-8 into the cflags passed into the various g-ir-scanner command lines that are used to generate the *.gir files, where -utf-8 is available, so that we don't get flooded with C4819 warnings during the build, and therefore avoid potential mishaps, as C4819 is a real warning that warngs us the code may be incorrectly built.
* gitypelibtest: make tests fail if the library can't be foundChristoph Reiter2019-10-191-1/+3
| | | | | | | | Check that g_object_info_get_ref_function_pointer() actually returns something, which it doesn't if the shared lib isn't found. In case a shared lib isn't found g-i will emit a warning, so also make sure we fail on warnings to avoid similar problems in the future.
* tests: Actually test libregress by specifying the LD_LIBRARY_PATHCorentin Noël2019-10-191-0/+4
|
* meson: change "doctool" from a boolean to a feature optionChristoph Reiter2019-09-301-1/+1
| | | | | | | Similar to !180 this should prevent devs from not running all tests by accident. This also adds some checks for the required doctool dependencies, mako and markdown.
* meson: change "cairo" from a boolean to a feature optionChristoph Reiter2019-09-281-7/+7
| | | | | | | | | We require cairo only to run all tests and thus default it to false. This usually results in developers not using it when working on changes and tests depending on cairo then failing in CI. This changes it to a feature option that defaults to auto, so that devs that have cairo headers installed will automatically use it.
* Support array arguments with static keywordEmmanuele Bassi2019-09-157-303/+455
| | | | | | | | | | | | | | | | | | | | | | | 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
* tests: Don't include "config.h" in installed filesPhilip Chimento2019-08-158-163/+181
| | | | | | These tests get installed, so config.h may not be available. Do the same thing that gimarshallingtests.c and regress.c already do, and include config.h conditionally.
* ccompiler: use the distutils linker in the dumperChristoph Reiter2019-08-081-0/+5
| | | | | No need to hardcode things since distutils looks it up. Similar to !170 but for Windows.
* regress: Add regression test for signal with GError paramPhilip Chimento2019-08-0113-283/+701
| | | | | | | | 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.
* transformer: only include function macros from headers. See #159Christoph Reiter2019-07-223-46/+0
| | | | | We already do the same thing for constants (see _create_const()). Otherwise macros in .c files which aren't namespaced will trigger a warning.
* scanner: parse and expose function macrosMathieu Duponchelle2019-07-1944-5/+997
| | | | | This is useful for documentation tools, and other utilities that rely on full introspection of the C API of a given library.
* gimarshallingtests: Add a marshalling test case for GPtrArrays and GArrays ↵Stéphane Seng2019-07-142-0/+52
| | | | | | | | | | | | | | | of structures Prior to this, the only marshalling test cases available for GPtrArrays were for GPtrArrays of strings. This commit adds a marshalling test case for GPtrArrays of structures, with the same objective than the gi_marshalling_tests_array_zero_terminated_return_struct() test case. This also adds a similar marshalling test case for GArrays of structures, for completeness. This is a follow-up to https://gitlab.gnome.org/GNOME/gjs/issues/9 where a regression has been detected with these types of GPtrArrays.
* girepository: Return pointer array for interface cachePhilip Chimento2019-06-201-0/+24
| | | | | | | | | | | | | In g_irepository_get_object_gtype_interfaces(), returning the address of the first GIBaseInfo* does not work reliably, because the GIBaseInfos are not necessarily stored contiguously. So the second and subsequent ones might be garbage. Instead, return the address of the array of GIBaseInfo pointers. Add a test that verifies the functionality, as well. This is unfortunately an API and ABI break.
* gi-test: Fix gir file testsChun-wei Fan2019-05-021-1/+1
| | | | | | | | | | | | | | | | | | | Meson unfortunately does not normalize the paths for us, so we couldn't just rely on it to give us the correct target name without the full target path when the path separator is not '/' (such as on Visual Studio builds, where the path separator is '\\' (with escape character). This means that, that on Visual Studio builds, targetname would be: D:\\gi.build\\tests\\scanner\\Typedefs-1.0.gir instead of: Typedefs-1.0.gir Since we have the targetbase variable which actually has the correct info we need, use that to deduce the correct reference .gir file to compare to.
* build: Force-include msvc_recommended_pragmas.h on Visual StudioChun-wei Fan2019-04-302-14/+26
| | | | | | | | | | By doing so, we essentially cover the various compiler flags that we want to use for non-Visual Studio builds to check for warnings that might cause real concern. This also skips the checks for the various GCC-isque CFlag checks that are scattered in the various build files on Visual Studio builds, since they are essentially meaningless on Visual Studio builds.
* scanner: Fix error on Windows in case source files are on different drivesChristoph Reiter2019-04-211-0/+10
| | | | | | | | | os.path.commonpath() raises ValueError if the paths given to it are on different drives. Handle that case by giving up and add a test. Reported here: https://github.com/msys2/MINGW-packages/pull/5258#issuecomment-485230864
* regress: Check array length before accessingPhilip Chimento2019-04-152-37/+43
|
* 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-154-222/+247
| | | | | | | 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.
* meson: always pass --qiet to g-ir-scannerChristoph Reiter2019-04-073-0/+15
| | | | Less noisy build
* shlibs: fall back to basename on macOS for relative paths. Fixes #222Christoph Reiter2019-03-251-5/+26
| | | | | | | | | | | | | | | | | | | On macOS we ideally want to write the final absolute path of the library into the gir and typelib. Up until now we inferred the install path from the .la file in case we used libtool and through otool in case we weren't using libtool hoping that the install_name was matching the install path. meson currently sets the install_name of libraries to "@rpath/foo.dylib" and adds rpaths to the executables in the build dir. Only during install does it change the install_name to the absolute target path in all places. Since we get called during build time we only get the @rpath from otool, which then makes things fail at runtime since the executables don't have the matching rpath set. To make this somewhat work just fall back to the basename for relative paths, so we dlopen "foo.dylib" and depend on things being in /usr/local/lib or DYLD_FALLBACK_LIBRARY_PATH including the lib path (see man dlopen)