summaryrefslogtreecommitdiffstats
path: root/test/CMakeLists.txt
blob: df6bbe90790211508512a732ddd0918c9cf2691e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#=============================================================================
# Copyright Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

find_package(LibXml2 QUIET)

macro(castxml_test_cmd test)
  set(command $<TARGET_FILE:castxml> ${ARGN})
  add_test(
    NAME cmd.${test}
    COMMAND ${CMAKE_COMMAND}
    "-Dcommand:STRING=${command}"
    "-Dtest=cmd.${test}"
    -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
    )
endmacro()

macro(castxml_test_gccxml test)
  set(command $<TARGET_FILE:castxml>
    --castxml-gccxml --castxml-start start
    -std=c++98
    ${CMAKE_CURRENT_LIST_DIR}/input/${test}.cxx
    )
  add_test(
    NAME gccxml.${test}
    COMMAND ${CMAKE_COMMAND}
    "-Dcommand:STRING=${command}"
    "-Dtest=gccxml.${test}"
    "-Dxml=${test}.xml"
    "-Dxmllint=${LIBXML2_XMLLINT_EXECUTABLE}"
    -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
    )
endmacro()

set(empty_c ${CMAKE_CURRENT_LIST_DIR}/input/empty.c)
set(empty_cxx ${CMAKE_CURRENT_LIST_DIR}/input/empty.cxx)
set(empty_m ${CMAKE_CURRENT_LIST_DIR}/input/empty.m)
set(empty_mm ${CMAKE_CURRENT_LIST_DIR}/input/empty.mm)

castxml_test_cmd(no-arguments)

castxml_test_cmd(cc-missing --castxml-cc-gnu)
castxml_test_cmd(cc-twice --castxml-cc-msvc cl --castxml-cc-gnu gcc)
castxml_test_cmd(cc-unknown --castxml-cc-unknown cc)
castxml_test_cmd(gccxml-and-E --castxml-gccxml -E)
castxml_test_cmd(gccxml-twice --castxml-gccxml --castxml-gccxml)
castxml_test_cmd(gccxml-and-c99 --castxml-gccxml -std=c99 ${empty_c})
castxml_test_cmd(gccxml-and-c11 --castxml-gccxml -std=c11 ${empty_c})
castxml_test_cmd(gccxml-and-c++11 --castxml-gccxml -std=c++11 ${empty_cxx})
castxml_test_cmd(gccxml-and-c++1y --castxml-gccxml -std=c++1y ${empty_cxx})
castxml_test_cmd(gccxml-and-objc1 --castxml-gccxml ${empty_m})
castxml_test_cmd(gccxml-and-objc2 --castxml-gccxml ${empty_mm})
castxml_test_cmd(o-missing -o)
castxml_test_cmd(start-missing --castxml-start)

castxml_test_gccxml(ArrayType)
castxml_test_gccxml(ArrayType-incomplete)
castxml_test_gccxml(Class)
castxml_test_gccxml(Class-incomplete)
castxml_test_gccxml(Class-template)
castxml_test_gccxml(CvQualifiedType)
castxml_test_gccxml(Field)
castxml_test_gccxml(Function)
castxml_test_gccxml(Function-template)
castxml_test_gccxml(Function-throw)
castxml_test_gccxml(FundamentalType)
castxml_test_gccxml(Method)
castxml_test_gccxml(Namespace)
castxml_test_gccxml(OperatorFunction)
castxml_test_gccxml(OperatorMethod)
castxml_test_gccxml(PointerType)
castxml_test_gccxml(ReferenceType)
castxml_test_gccxml(Typedef-to-Class-template)
castxml_test_gccxml(Variable)

castxml_test_gccxml(qualified-type-name)