From fb6291d9c9224bedf207bf0077ad9f0a2690f867 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 20 Apr 2011 03:15:31 -0400 Subject: [PATCH] [test] Add test for headers included from C and C++ --- test/Makefile.am | 17 +++++++++++++++ test/test-c.c | 49 ++++++++++++++++++++++++++++++++++++++++++ test/test-cplusplus.cc | 29 +++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 test/test-c.c create mode 100644 test/test-cplusplus.cc diff --git a/test/Makefile.am b/test/Makefile.am index 499d00b15..e4fdb2028 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,6 +15,23 @@ TEST_PROGS += \ $(NULL) +# Tests for header compilation +TEST_PROGS += \ + test-c \ + test-cplusplus \ + $(NULL) +test_cplusplus_SOURCES = test-cplusplus.cc +test_c_CPPFLAGS = $(AM_CPPFLAGS) +test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS) +if HAVE_ICU +test_c_CPPFLAGS += $(ICU_CFLAGS) +test_cplusplus_CPPFLAGS += $(ICU_CFLAGS) +endif +if HAVE_FREETYPE +test_c_CPPFLAGS += $(FREETYPE_CFLAGS) +test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS) +endif + else check-am: diff --git a/test/test-c.c b/test/test-c.c new file mode 100644 index 000000000..37f02fff2 --- /dev/null +++ b/test/test-c.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +/* This file tests that all headers can be included from .c files */ + +#include + +#include + +#if HAVE_GLIB +#include +#endif + +#if HAVE_ICU +#include +#endif + +#if HAVE_FREETYPE +#include +#endif + +int +main (int argc, char **argv) +{ + return 0; +} diff --git a/test/test-cplusplus.cc b/test/test-cplusplus.cc new file mode 100644 index 000000000..3488b787e --- /dev/null +++ b/test/test-cplusplus.cc @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +/* This file tests that all headers can be included from .cc files */ + +#include "test-c.c"