25 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
57add9c860 Fix some clippy lints. 2021-06-21 13:25:53 +02:00
Vadim Petrochenkov
1c1d4754ce tests: Remove Cython-specific configs 2020-11-25 17:30:30 +01:00
Vadim Petrochenkov
51405d1277 Support generation of Cython bindings 2020-11-17 15:27:34 +01:00
Vadim Petrochenkov
3a7e24d2d7 test suite: Do not generate identical expectation files 2020-10-20 22:59:14 +02:00
Vadim Petrochenkov
d09fe6b753 test suite: Use suffixes instead of directories for test variants 2020-10-19 20:33:29 +02:00
Emilio Cobos Álvarez
5d1217c7c0
tests: Instead of adding skip_cpp as a feature, make the tests work with C++ 2020-09-29 13:36:46 +02:00
Ivan Enderlin
4304907d01
test: Support a new .skip_cpp test suffix.
Following the example of `.skip_warning_as_error`, this patch
introduces a `.skip_cpp` suffix to skip the generation of `.cpp`
files.

This patch also simplifies the code. Ideally, we would create and
implement a new trait offering an API like `is_cpp_skipped`,
`is_warning_as_error_skipped`, and `normalize` (to remove all
suffixes), but it's a little bit overkill for our needs right now.
2020-09-29 13:36:46 +02:00
Emilio Cobos Álvarez
6ba31b49f4 tests: Fix errors when testing with clang.
Fixes #554
2020-07-31 12:07:20 +02:00
Igor Sadchenko
6fce1ccc4b Review fixes. Add parameter skip_warning_as_error to skip threat a warning as an error 2020-04-14 19:03:55 +02:00
Igor Sadchenko
4baadb049d Review fixes 2020-04-14 19:03:55 +02:00
Igor Sadchenko
275b36fb09 Added pragma once option. Issue #510 2020-04-14 19:03:55 +02:00
Emilio Cobos Álvarez
a519f1bda4 Actually use the temp dir for temporary compiled objects.
If the cbindgen_output is an absolute path, then join() will just return it.

Really fixes #499.
2020-04-04 23:46:42 +02:00
Emilio Cobos Álvarez
39bae60ad7 Generate test object files in a temporary directory instead of in-tree
Closes #499

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2020-04-04 17:54:52 +02:00
AlaskanEmily
dfa6e5f982 Check for CFLAGS and CXXFLAGS when running tests
This is needed when running tests with clang/clang++, as some of the tests have
errors that clang reports which gcc does not such as unused static const
variables.
2020-02-25 01:24:27 +01:00
Emilio Cobos Álvarez
12248c2fef tests: Add a simple testing-helpers headers that tests can include.
This allows to assert easily as described in the previous commit.
2020-01-26 02:35:39 +01:00
Emilio Cobos Álvarez
bd831ded19 tests: Provide style definition to the C / C++ tests.
This will be useful to add static assertion to some tests like #463 wants to do.

For example, in the case of the test for #463, the test would need something
like:

    trailer = """
    #include <assert.h>

    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    static_assert(sizeof(struct P) == 4, "unexpected size for P");
    #else
    static_assert(sizeof(P) == 4, "unexpected size for P");
    #endif
    """

As more of these tests are added it may be worth just adding a helper header
like this to avoid some duplication:

    #include <assert.h>
    #if defined(CBINDGEN_STYLE_TAG) && !defined(__cplusplus)
    #define CBINDGEN_STRUCT(name) struct name
    #else
    #define CBINDGEN_STRUCT(name) name
    #endif

And so on, so the previous configuration would become just:

    trailer = """
    #include "testing-helpers.h" // Or whatever
    static_assert(sizeof(CBINDGEN_STRUCT(P)) == 4, "unexpected size for P");
    """

That may or may not be overkill to do as part of #463.
2020-01-26 02:35:39 +01:00
John VanEnk
70188bb3b2 Enable most warnings, and make them errors.
This adds `-Wall` and `-Werror` to the C and C++ compiler flags. It
also adds `-Wno-attributes` to disable warnings about unrecognized
attributes. This is needed because the `swift_name` test relies on
`__attribute__((swift_name(some_name)))` attribute.
2020-01-24 11:22:39 +01:00
John VanEnk
fb348d91e8 Change std=c++11 to std=c++17 to support inline variables.
The inline variables feature is used by the associated_in_body test.
2020-01-24 11:22:39 +01:00
Wodann
af95d87c05 Improve verbosity of cpp_compat test cases 2019-06-01 10:59:43 +09:00
Wodann
bbeff3e3aa Add option to generate C headers with C++ compatibility
By default C++ compatibility is disabled.
2019-06-01 10:57:50 +09:00
Wodann
767fce25d1 Add support for selection of a custom C++ compiler 2019-06-01 10:56:09 +09:00
Wodann
7970564887 Add stderr output of cbindgen to a tests error log upon failure 2019-06-01 10:56:09 +09:00
Emilio Cobos Álvarez
357f34460d Do a better job at detecting the final binary location.
Still not great, I guess we should convert the tests to run the library version
of cbindgen, but this trivially-fixes #342.
2019-05-23 16:40:06 +02:00
Alexis Beingessner
ee2af57499 require c++11 to run the test suite
fixes #330
2019-05-10 17:58:52 -04:00
Emilio Cobos Álvarez
2bb3e9ba66 Use cargo test instead of test.py.
This makes cargo test test all the stuff in tests/rust, and thus makes tests.py
unnecessary.

Co-authored-by: Axel Nennker <axel.nennker@telekom.de>
2019-04-20 00:30:58 +02:00