summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt10
-rw-r--r--Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake11
-rw-r--r--Tests/CMakeTests/StringTest.cmake.in3
-rw-r--r--Tests/FindBZip2/CMakeLists.txt10
-rw-r--r--Tests/FindBZip2/Test/CMakeLists.txt16
-rw-r--r--Tests/FindBZip2/Test/main.c23
-rw-r--r--Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake67
-rw-r--r--Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/GEH.cmake2
-rw-r--r--Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp138
-rw-r--r--Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp65
-rw-r--r--Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h85
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp65
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libshared/libshared.h71
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp68
-rw-r--r--Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h75
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake30
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt1
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake4
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt1
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt5
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake4
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt1
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake1
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt1
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake3
-rw-r--r--Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt0
-rw-r--r--Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt5
-rw-r--r--Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake5
-rw-r--r--Tests/RunCMake/file/DOWNLOAD-unused-argument.txt0
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/file/UPLOAD-unused-argument-result.txt0
-rw-r--r--Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt5
-rw-r--r--Tests/RunCMake/file/UPLOAD-unused-argument.cmake5
-rw-r--r--Tests/RunCMake/file/UPLOAD-unused-argument.txt0
41 files changed, 606 insertions, 206 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8293286..97770ed 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1356,6 +1356,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindBoost)
endif()
+ if(CMake_TEST_FindBZip2)
+ add_subdirectory(FindBZip2)
+ endif()
+
if(CMake_TEST_FindGSL)
add_subdirectory(FindGSL)
endif()
@@ -1412,9 +1416,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
# Matlab module
if(CMake_TEST_FindMatlab)
- ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
- ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
- ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
+ ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
+ ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
+ ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>)
endif()
find_package(GTK2 QUIET)
diff --git a/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake
new file mode 100644
index 0000000..1cd44ff
--- /dev/null
+++ b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake
@@ -0,0 +1,11 @@
+string(TIMESTAMP output "%a;%b")
+message("~${output}~")
+
+list(LENGTH output output_length)
+
+set(expected_output_length 2)
+
+if(NOT output_length EQUAL ${expected_output_length})
+ message(FATAL_ERROR "expected ${expected_output_length} entries in output "
+ "with all specifiers; found ${output_length}")
+endif()
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index aba35fe..a45b205 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -36,6 +36,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0)
set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~")
set(TIMESTAMP-AllSpecifiers-RESULT 0)
set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~")
+set(TIMESTAMP-MonthWeekNames-RESULT 0)
+set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~")
set(TIMESTAMP-UnixTime-RESULT 0)
set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~")
@@ -60,6 +62,7 @@ check_cmake_test(String
TIMESTAMP-UnknownSpecifier
TIMESTAMP-IncompleteSpecifier
TIMESTAMP-AllSpecifiers
+ TIMESTAMP-MonthWeekNames
TIMESTAMP-UnixTime
)
diff --git a/Tests/FindBZip2/CMakeLists.txt b/Tests/FindBZip2/CMakeLists.txt
new file mode 100644
index 0000000..0eb3b99
--- /dev/null
+++ b/Tests/FindBZip2/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindBZip2.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindBZip2/Test"
+ "${CMake_BINARY_DIR}/Tests/FindBZip2/Test"
+ ${build_generator_args}
+ --build-project TestFindBZip2
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindBZip2/Test/CMakeLists.txt b/Tests/FindBZip2/Test/CMakeLists.txt
new file mode 100644
index 0000000..e9cb618
--- /dev/null
+++ b/Tests/FindBZip2/Test/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindBZip2 C)
+include(CTest)
+
+find_package(BZip2 REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_BZip2_VERSION="${BZip2_VERSION_STRING}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt BZip2::BZip2)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${BZIP2_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${BZIP2_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c
new file mode 100644
index 0000000..8e24c94
--- /dev/null
+++ b/Tests/FindBZip2/Test/main.c
@@ -0,0 +1,23 @@
+#include <bzlib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main()
+{
+ int chunksize = 1024;
+ FILE* file = fopen("test.bzip2", "wb");
+ char* buf = malloc(sizeof(char) * chunksize);
+ int error, rsize;
+ unsigned int in, out;
+ BZFILE* bzfile = BZ2_bzWriteOpen(&error, file, 64, 1, 10);
+
+ /* Don't actually write anything for the purposes of the test */
+
+ BZ2_bzWriteClose(&error, bzfile, 1, &in, &out);
+ free(buf);
+ fclose(file);
+
+ remove("test.bzip2");
+
+ return 0;
+}
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake
new file mode 100644
index 0000000..7182cdf
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake
@@ -0,0 +1,67 @@
+set(failure_test_executables
+ ${CMAKE_CURRENT_BINARY_DIR}/failure_test_targets)
+file(WRITE ${failure_test_executables} "")
+
+# Check if we should do anything. If the compiler doesn't support hidden
+# visibility, the failure tests won't fail, so just write an empty targets
+# list and punt.
+if(NOT WIN32 AND NOT CYGWIN AND NOT COMPILER_HAS_HIDDEN_VISIBILITY)
+ return()
+endif()
+
+# Read the input source file
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/exportheader_test.cpp content_post)
+set(content_pre "")
+
+# Generate source files for failure test executables
+set(counter 0)
+while(1)
+ # Find first occurrence of link error marker in remaining content
+ string(REGEX MATCH "//([^;\n]+;) LINK ERROR( [(][^)]+[)])?\n(.*)"
+ match "${content_post}")
+ if(match STREQUAL "")
+ # No more matches
+ break()
+ endif()
+
+ # Shift content buffers and extract failing statement
+ string(LENGTH "${content_post}" content_post_length)
+ string(LENGTH "${match}" matched_length)
+ math(EXPR shift_length "${content_post_length} - ${matched_length}")
+
+ string(SUBSTRING "${content_post}" 0 ${shift_length} shift)
+ set(content_pre "${content_pre}${shift}")
+ set(content_post "${CMAKE_MATCH_3}")
+ set(content_active "//${CMAKE_MATCH_1} LINK ERROR${CMAKE_MATCH_2}")
+ set(statement "${CMAKE_MATCH_1}")
+
+ # Check if potential error is conditional, and evaluate condition if so
+ string(REGEX REPLACE " [(]([^)]+)[)]" "\\1" condition "${CMAKE_MATCH_2}")
+ if(NOT condition STREQUAL "")
+ string(REGEX REPLACE " +" ";" condition "${condition}")
+ if(${condition})
+ else()
+ message(STATUS "Not testing '${statement}'; "
+ "condition (${condition}) is FALSE")
+ set(content_pre "${content_pre}// link error removed\n")
+ continue()
+ endif()
+ endif()
+
+ if(NOT skip)
+ message(STATUS "Creating failure test for '${statement}'")
+ math(EXPR counter "${counter} + 1")
+
+ # Write new source file
+ set(out ${CMAKE_CURRENT_BINARY_DIR}/exportheader_failtest-${counter}.cpp)
+ file(WRITE ${out} "${content_pre}${statement}\n${content_post}")
+
+ # Add executable for failure test
+ add_executable(GEH-fail-${counter} EXCLUDE_FROM_ALL ${out})
+ target_link_libraries(GEH-fail-${counter} ${link_libraries})
+ file(APPEND ${failure_test_executables} "GEH-fail-${counter}\n")
+ endif()
+
+ # Add placeholder where failing statement was removed
+ set(content_pre "${content_pre}${content_active}\n")
+endwhile()
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake
index ee0871b..cddba29 100644
--- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake
+++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake
@@ -123,3 +123,5 @@ target_compile_definitions(GenerateExportHeader
"SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\""
"BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
)
+
+include(${CMAKE_CURRENT_LIST_DIR}/GEH-failures.cmake)
diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
index e534c1f..9423ef5 100644
--- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake
@@ -12,6 +12,16 @@ function(run_GEH)
run_cmake(GEH)
run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader)
+
+ file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets"
+ failure_test_targets)
+
+ foreach(failure_test_target ${failure_test_targets})
+ run_cmake_command(GEH-link-error ${CMAKE_COMMAND}
+ --build .
+ --config Debug
+ --target ${failure_test_target})
+ endforeach()
endfunction()
run_GEH()
diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
index 26bea7e..7e3e0e4 100644
--- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp
@@ -3,14 +3,6 @@
#include "libstatic.h"
-// #define BUILD_FAIL
-
-#ifndef BUILD_FAIL
-#define DOES_NOT_BUILD(function)
-#else
-#define DOES_NOT_BUILD(function) function
-#endif
-
#include <fstream>
#include <iostream>
#include <stdlib.h>
@@ -64,74 +56,114 @@ void compare(const char* refName, const char* testName)
int main()
{
{
- Libshared l;
- l.libshared();
- l.libshared_exported();
- l.libshared_deprecated();
- l.libshared_not_exported();
-
- DOES_NOT_BUILD(l.libshared_excluded();)
+ libshared::Class l;
+ // l.method(); LINK ERROR
+ l.method_exported();
+ // l.method_deprecated(); LINK ERROR
+ l.method_deprecated_exported();
+ // l.method_excluded(); LINK ERROR
+
+ // use_int(l.data); LINK ERROR
+ use_int(l.data_exported);
+ // use_int(l.data_excluded); LINK ERROR
}
{
- LibsharedNotExported l;
- DOES_NOT_BUILD(l.libshared();)
- l.libshared_exported();
- l.libshared_deprecated();
- DOES_NOT_BUILD(l.libshared_not_exported();)
- DOES_NOT_BUILD(l.libshared_excluded();)
+ libshared::ExportedClass l;
+ l.method();
+ l.method_deprecated();
+#if defined(_WIN32) || defined(__CYGWIN__)
+ l.method_excluded();
+#else
+// l.method_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN)
+#endif
+
+ use_int(l.data);
+#if defined(_WIN32) || defined(__CYGWIN__)
+ use_int(l.data_excluded);
+#else
+// use_int(l.data_excluded); LINK ERROR (NOT WIN32 AND NOT CYGWIN)
+#endif
}
{
- LibsharedExcluded l;
- DOES_NOT_BUILD(l.libshared();)
- l.libshared_exported();
- l.libshared_deprecated();
- DOES_NOT_BUILD(l.libshared_not_exported();)
- DOES_NOT_BUILD(l.libshared_excluded();)
+ libshared::ExcludedClass l;
+ // l.method(); LINK ERROR
+ l.method_exported();
+ // l.method_deprecated(); LINK ERROR
+ l.method_deprecated_exported();
+ // l.method_excluded(); LINK ERROR
+
+ // use_int(l.data); LINK ERROR
+ use_int(l.data_exported);
+ // use_int(l.data_excluded); LINK ERROR
}
- libshared_exported();
- libshared_deprecated();
- DOES_NOT_BUILD(libshared_not_exported();)
- DOES_NOT_BUILD(libshared_excluded();)
+ // libshared::function(); LINK ERROR
+ libshared::function_exported();
+ // libshared::function_deprecated(); LINK ERROR
+ libshared::function_deprecated_exported();
+ // libshared::function_excluded(); LINK ERROR
+
+ // use_int(libshared::data); LINK ERROR
+ use_int(libshared::data_exported);
+ // use_int(libshared::data_excluded); LINK ERROR
{
- Libstatic l;
- l.libstatic();
- l.libstatic_exported();
- l.libstatic_deprecated();
- l.libstatic_not_exported();
- l.libstatic_excluded();
+ libstatic::Class l;
+ l.method();
+ l.method_exported();
+ l.method_deprecated();
+ l.method_deprecated_exported();
+ l.method_excluded();
+
+ use_int(l.data);
+ use_int(l.data_exported);
+ use_int(l.data_excluded);
}
{
- LibstaticNotExported l;
- l.libstatic();
- l.libstatic_exported();
- l.libstatic_deprecated();
- l.libstatic_not_exported();
- l.libstatic_excluded();
+ libstatic::ExportedClass l;
+ l.method();
+ l.method_exported();
+ l.method_deprecated();
+ l.method_deprecated_exported();
+ l.method_excluded();
+
+ use_int(l.data);
+ use_int(l.data_exported);
+ use_int(l.data_excluded);
}
{
- LibstaticExcluded l;
- l.libstatic();
- l.libstatic_exported();
- l.libstatic_deprecated();
- l.libstatic_not_exported();
- l.libstatic_excluded();
+ libstatic::ExcludedClass l;
+ l.method();
+ l.method_exported();
+ l.method_deprecated();
+ l.method_deprecated_exported();
+ l.method_excluded();
+
+ use_int(l.data);
+ use_int(l.data_exported);
+ use_int(l.data_excluded);
}
- libstatic_exported();
- libstatic_deprecated();
- libstatic_not_exported();
- libstatic_excluded();
+ libstatic::function();
+ libstatic::function_exported();
+ libstatic::function_deprecated();
+ libstatic::function_deprecated_exported();
+ libstatic::function_excluded();
+
+ use_int(libstatic::data);
+ use_int(libstatic::data_exported);
+ use_int(libstatic::data_excluded);
+#if defined(SRC_DIR) && defined(BIN_DIR)
compare(SRC_DIR "/libshared_export.h",
BIN_DIR "/libshared/libshared_export.h");
compare(SRC_DIR "/libstatic_export.h",
BIN_DIR "/libstatic/libstatic_export.h");
+#endif
return 0;
}
diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
index 846c207..9ac8381 100644
--- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
@@ -1,106 +1,121 @@
-
#include "libshared_and_static.h"
#ifndef MY_CUSTOM_CONTENT_ADDED
#error "MY_CUSTOM_CONTENT_ADDED not defined!"
#endif
-int LibsharedAndStatic::libshared_and_static() const
+int libshared_and_static::Class::method() const
{
return 0;
}
-int LibsharedAndStatic::libshared_and_static_exported() const
+int libshared_and_static::Class::method_exported() const
{
return 0;
}
-int LibsharedAndStatic::libshared_and_static_deprecated() const
+int libshared_and_static::Class::method_deprecated() const
{
return 0;
}
-int LibsharedAndStatic::libshared_and_static_not_exported() const
+int libshared_and_static::Class::method_deprecated_exported() const
{
return 0;
}
-int LibsharedAndStatic::libshared_and_static_excluded() const
+int libshared_and_static::Class::method_excluded() const
{
return 0;
}
-int LibsharedAndStaticNotExported::libshared_and_static() const
-{
- return 0;
-}
+int const libshared_and_static::Class::data = 1;
-int LibsharedAndStaticNotExported::libshared_and_static_exported() const
+int const libshared_and_static::Class::data_exported = 1;
+
+int const libshared_and_static::Class::data_excluded = 1;
+
+int libshared_and_static::ExportedClass::method() const
{
return 0;
}
-int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const
+int libshared_and_static::ExportedClass::method_deprecated() const
{
return 0;
}
-int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const
+int libshared_and_static::ExportedClass::method_excluded() const
{
return 0;
}
-int LibsharedAndStaticNotExported::libshared_and_static_excluded() const
+int const libshared_and_static::ExportedClass::data = 1;
+
+int const libshared_and_static::ExportedClass::data_excluded = 1;
+
+int libshared_and_static::ExcludedClass::method() const
{
return 0;
}
-int LibsharedAndStaticExcluded::libshared_and_static() const
+int libshared_and_static::ExcludedClass::method_exported() const
{
return 0;
}
-int LibsharedAndStaticExcluded::libshared_and_static_exported() const
+int libshared_and_static::ExcludedClass::method_deprecated() const
{
return 0;
}
-int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const
+int libshared_and_static::ExcludedClass::method_deprecated_exported() const
{
return 0;
}
-int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const
+int libshared_and_static::ExcludedClass::method_excluded() const
{
return 0;
}
-int LibsharedAndStaticExcluded::libshared_and_static_excluded() const
+int const libshared_and_static::ExcludedClass::data = 1;
+
+int const libshared_and_static::ExcludedClass::data_exported = 1;
+
+int const libshared_and_static::ExcludedClass::data_excluded = 1;
+
+int libshared_and_static::function()
{
return 0;
}
-int libshared_and_static()
+int libshared_and_static::function_exported()
{
return 0;
}
-int libshared_and_static_exported()
+int libshared_and_static::function_deprecated()
{
return 0;
}
-int libshared_and_static_deprecated()
+int libshared_and_static::function_deprecated_exported()
{
return 0;
}
-int libshared_and_static_not_exported()
+int libshared_and_static::function_excluded()
{
return 0;
}
-int libshared_and_static_excluded()
+int const libshared_and_static::data = 1;
+
+int const libshared_and_static::data_exported = 1;
+
+int const libshared_and_static::data_excluded = 1;
+
+void use_int(int)
{
- return 0;
}
diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
index ea672fe..2c3fcfd 100644
--- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
+++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h
@@ -1,66 +1,83 @@
-
-#ifndef SHARED_AND_STATIC_H
-#define SHARED_AND_STATIC_H
+#ifndef LIBSHARED_AND_STATIC_H
+#define LIBSHARED_AND_STATIC_H
#include "libshared_and_static_export.h"
-class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic
+namespace libshared_and_static {
+
+class Class
{
public:
- int libshared_and_static() const;
+ int method() const;
+
+ int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const;
+
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const;
- int libshared_and_static_exported() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT
+ method_deprecated_exported() const;
- int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED
- libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const;
- int libshared_and_static_not_exported() const;
+ static int const data;
- int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT
- libshared_and_static_excluded() const;
+ static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported;
+
+ static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded;
};
-class LibsharedAndStaticNotExported
+class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT ExportedClass
{
public:
- int libshared_and_static() const;
+ int method() const;
- int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT
- libshared_and_static_exported() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const;
- int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED
- libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const;
- int libshared_and_static_not_exported() const;
+ static int const data;
- int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT
- libshared_and_static_excluded() const;
+ static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded;
};
-class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded
+class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT ExcludedClass
{
public:
- int libshared_and_static() const;
+ int method() const;
+
+ int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const;
+
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const;
- int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT
- libshared_and_static_exported() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT
+ method_deprecated_exported() const;
- int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED
- libshared_and_static_deprecated() const;
+ int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const;
- int libshared_and_static_not_exported() const;
+ static int const data;
- int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT
- libshared_and_static_excluded() const;
+ static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported;
+
+ static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded;
};
-MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported();
+int function();
+
+int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT function_exported();
+
+int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED function_deprecated();
+
+int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT
+function_deprecated_exported();
+
+int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT function_excluded();
+
+extern int const data;
-MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int
-libshared_and_static_deprecated();
+extern int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported;
-int libshared_and_static_not_exported();
+extern int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded;
-int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded();
+} // namespace libshared_and_static
#endif
diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
index ad6d356..328ef6f 100644
--- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp
@@ -1,102 +1,117 @@
-
#include "libshared.h"
-int Libshared::libshared() const
+int libshared::Class::method() const
{
return 0;
}
-int Libshared::libshared_exported() const
+int libshared::Class::method_exported() const
{
return 0;
}
-int Libshared::libshared_deprecated() const
+int libshared::Class::method_deprecated() const
{
return 0;
}
-int Libshared::libshared_not_exported() const
+int libshared::Class::method_deprecated_exported() const
{
return 0;
}
-int Libshared::libshared_excluded() const
+int libshared::Class::method_excluded() const
{
return 0;
}
-int LibsharedNotExported::libshared() const
-{
- return 0;
-}
+int const libshared::Class::data = 1;
-int LibsharedNotExported::libshared_exported() const
+int const libshared::Class::data_exported = 1;
+
+int const libshared::Class::data_excluded = 1;
+
+int libshared::ExportedClass::method() const
{
return 0;
}
-int LibsharedNotExported::libshared_deprecated() const
+int libshared::ExportedClass::method_deprecated() const
{
return 0;
}
-int LibsharedNotExported::libshared_not_exported() const
+int libshared::ExportedClass::method_excluded() const
{
return 0;
}
-int LibsharedNotExported::libshared_excluded() const
+int const libshared::ExportedClass::data = 1;
+
+int const libshared::ExportedClass::data_excluded = 1;
+
+int libshared::ExcludedClass::method() const
{
return 0;
}
-int LibsharedExcluded::libshared() const
+int libshared::ExcludedClass::method_exported() const
{
return 0;
}
-int LibsharedExcluded::libshared_exported() const
+int libshared::ExcludedClass::method_deprecated() const
{
return 0;
}
-int LibsharedExcluded::libshared_deprecated() const
+int libshared::ExcludedClass::method_deprecated_exported() const
{
return 0;
}
-int LibsharedExcluded::libshared_not_exported() const
+int libshared::ExcludedClass::method_excluded() const
{
return 0;
}
-int LibsharedExcluded::libshared_excluded() const
+int const libshared::ExcludedClass::data = 1;
+
+int const libshared::ExcludedClass::data_exported = 1;
+
+int const libshared::ExcludedClass::data_excluded = 1;
+
+int libshared::function()
{
return 0;
}
-int libshared()
+int libshared::function_exported()
{
return 0;
}
-int libshared_exported()
+int libshared::function_deprecated()
{
return 0;
}
-int libshared_deprecated()
+int libshared::function_deprecated_exported()
{
return 0;
}
-int libshared_not_exported()
+int libshared::function_excluded()
{
return 0;
}
-int libshared_excluded()
+int const libshared::data = 1;
+
+int const libshared::data_exported = 1;
+
+int const libshared::data_excluded = 1;
+
+void use_int(int)
{
- return 0;
}
diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
index bd9f2e3..6574bd5 100644
--- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
+++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h
@@ -1,57 +1,82 @@
-
#ifndef LIBSHARED_H
#define LIBSHARED_H
#include "libshared_export.h"
-class LIBSHARED_EXPORT Libshared
+namespace libshared {
+
+class Class
{
public:
- int libshared() const;
+ int method() const;
+
+ int LIBSHARED_EXPORT method_exported() const;
+
+ int LIBSHARED_DEPRECATED method_deprecated() const;
- int libshared_exported() const;
+ int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSHARED_DEPRECATED libshared_deprecated() const;
+ int LIBSHARED_NO_EXPORT method_excluded() const;
- int libshared_not_exported() const;
+ static int const data;
- int LIBSHARED_NO_EXPORT libshared_excluded() const;
+ static int const LIBSHARED_EXPORT data_exported;
+
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
-class LibsharedNotExported
+class LIBSHARED_EXPORT ExportedClass
{
public:
- int libshared() const;
+ int method() const;
- int LIBSHARED_EXPORT libshared_exported() const;
+ int LIBSHARED_DEPRECATED method_deprecated() const;
- int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const;
+ int LIBSHARED_NO_EXPORT method_excluded() const;
- int libshared_not_exported() const;
+ static int const data;
- int LIBSHARED_NO_EXPORT libshared_excluded() const;
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
-class LIBSHARED_NO_EXPORT LibsharedExcluded
+class LIBSHARED_NO_EXPORT ExcludedClass
{
public:
- int libshared() const;
+ int method() const;
+
+ int LIBSHARED_EXPORT method_exported() const;
+
+ int LIBSHARED_DEPRECATED method_deprecated() const;
- int LIBSHARED_EXPORT libshared_exported() const;
+ int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const;
+ int LIBSHARED_NO_EXPORT method_excluded() const;
- int libshared_not_exported() const;
+ static int const data;
- int LIBSHARED_NO_EXPORT libshared_excluded() const;
+ static int const LIBSHARED_EXPORT data_exported;
+
+ static int const LIBSHARED_NO_EXPORT data_excluded;
};
-LIBSHARED_EXPORT int libshared_exported();
+int function();
+
+int LIBSHARED_EXPORT function_exported();
+
+int LIBSHARED_DEPRECATED function_deprecated();
+
+int LIBSHARED_DEPRECATED_EXPORT function_deprecated_exported();
+
+int LIBSHARED_NO_EXPORT function_excluded();
+
+extern int const data;
+
+extern int const LIBSHARED_EXPORT data_exported;
-LIBSHARED_DEPRECATED_EXPORT int libshared_deprecated();
+extern int const LIBSHARED_NO_EXPORT data_excluded;
-int libshared_not_exported();
+} // namespace libshared
-int LIBSHARED_NO_EXPORT libshared_excluded();
+LIBSHARED_EXPORT void use_int(int);
#endif
diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
index 89381af..e1d1255 100644
--- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
+++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp
@@ -1,97 +1,125 @@
-
#include "libstatic.h"
-int Libstatic::libstatic() const
+int libstatic::Class::method() const
{
return 0;
}
-int Libstatic::libstatic_exported() const
+int libstatic::Class::method_exported() const
{
return 0;
}
-int Libstatic::libstatic_deprecated() const
+int libstatic::Class::method_deprecated() const
{
return 0;
}
-int Libstatic::libstatic_not_exported() const
+int libstatic::Class::method_deprecated_exported() const
{
return 0;
}
-int Libstatic::libstatic_excluded() const
+int libstatic::Class::method_excluded() const
{
return 0;
}
-int LibstaticNotExported::libstatic() const
+int const libstatic::Class::data = 1;
+
+int const libstatic::Class::data_exported = 1;
+
+int const libstatic::Class::data_excluded = 1;
+
+int libstatic::ExportedClass::method() const
{
return 0;
}
-int LibstaticNotExported::libstatic_exported() const
+int libstatic::ExportedClass::method_exported() const
{
return 0;
}
-int LibstaticNotExported::libstatic_deprecated() const
+int libstatic::ExportedClass::method_deprecated() const
{
return 0;
}
-int LibstaticNotExported::libstatic_not_exported() const
+int libstatic::ExportedClass::method_deprecated_exported() const
{
return 0;
}
-int LibstaticNotExported::libstatic_excluded() const
+int libstatic::ExportedClass::method_excluded() const
{
return 0;
}
-int LibstaticExcluded::libstatic() const
+int const libstatic::ExportedClass::data = 1;
+
+int const libstatic::ExportedClass::data_exported = 1;
+
+int const libstatic::ExportedClass::data_excluded = 1;
+
+int libstatic::ExcludedClass::method() const
{
return 0;
}
-int LibstaticExcluded::libstatic_exported() const
+int libstatic::ExcludedClass::method_exported() const
{
return 0;
}
-int LibstaticExcluded::libstatic_deprecated() const
+int libstatic::ExcludedClass::method_deprecated() const
{
return 0;
}
-int LibstaticExcluded::libstatic_not_exported() const
+int libstatic::ExcludedClass::method_deprecated_exported() const
{
return 0;
}
-int LibstaticExcluded::libstatic_excluded() const
+int libstatic::ExcludedClass::method_excluded() const
{
return 0;
}
-int libstatic_exported()
+int const libstatic::ExcludedClass::data = 1;
+
+int const libstatic::ExcludedClass::data_exported = 1;
+
+int const libstatic::ExcludedClass::data_excluded = 1;
+
+int libstatic::function()
+{
+ return 0;
+}
+
+int libstatic::function_exported()
{
return 0;
}
-int libstatic_deprecated()
+int libstatic::function_deprecated()
{
return 0;
}
-int libstatic_not_exported()
+int libstatic::function_deprecated_exported()
{
return 0;
}
-int libstatic_excluded()
+int libstatic::function_excluded()
{
return 0;
}
+
+int const libstatic::data = 1;
+
+int const libstatic::data_exported = 1;
+
+int const libstatic::data_excluded = 1;
diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
index 6072d9b..1017e12 100644
--- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
+++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h
@@ -1,57 +1,86 @@
-
#ifndef LIBSTATIC_H
#define LIBSTATIC_H
#include "libstatic_export.h"
-class LIBSTATIC_EXPORT Libstatic
+namespace libstatic {
+
+class Class
{
public:
- int libstatic() const;
+ int method() const;
+
+ int LIBSTATIC_EXPORT method_exported() const;
+
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
- int libstatic_exported() const;
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
- int libstatic_not_exported() const;
+ static int const data;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ static int const LIBSTATIC_EXPORT data_exported;
+
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-class LibstaticNotExported
+class LIBSTATIC_EXPORT ExportedClass
{
public:
- int libstatic() const;
+ int method() const;
+
+ int LIBSTATIC_EXPORT method_exported() const;
+
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
+
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_EXPORT libstatic_exported() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ static int const data;
- int libstatic_not_exported() const;
+ static int const LIBSTATIC_EXPORT data_exported;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-class LIBSTATIC_NO_EXPORT LibstaticExcluded
+class LIBSTATIC_NO_EXPORT ExcludedClass
{
public:
- int libstatic() const;
+ int method() const;
- int LIBSTATIC_EXPORT libstatic_exported() const;
+ int LIBSTATIC_EXPORT method_exported() const;
- int LIBSTATIC_DEPRECATED libstatic_deprecated() const;
+ int LIBSTATIC_DEPRECATED method_deprecated() const;
- int libstatic_not_exported() const;
+ int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const;
- int LIBSTATIC_NO_EXPORT libstatic_excluded() const;
+ int LIBSTATIC_NO_EXPORT method_excluded() const;
+
+ static int const data;
+
+ static int const LIBSTATIC_EXPORT data_exported;
+
+ static int const LIBSTATIC_NO_EXPORT data_excluded;
};
-LIBSTATIC_EXPORT int libstatic_exported();
+int function();
+
+int LIBSTATIC_EXPORT function_exported();
+
+int LIBSTATIC_DEPRECATED function_deprecated();
+
+int LIBSTATIC_DEPRECATED_EXPORT function_deprecated_exported();
+
+int LIBSTATIC_NO_EXPORT function_excluded();
+
+extern int const data;
-LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated();
+extern int const LIBSTATIC_EXPORT data_exported;
-int libstatic_not_exported();
+extern int const LIBSTATIC_NO_EXPORT data_excluded;
-int LIBSTATIC_NO_EXPORT libstatic_excluded();
+} // namespace libstatic
#endif
diff --git a/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake b/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake
new file mode 100644
index 0000000..61bde03
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake
@@ -0,0 +1,30 @@
+include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake)
+
+function(test1)
+ cmake_parse_arguments(PARSE_ARGV 0
+ pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2")
+
+ TEST(pref_OPT1 TRUE)
+ TEST(pref_OPT2 FALSE)
+ TEST(pref_SINGLE1 "foo;bar")
+ TEST(pref_SINGLE2 UNDEFINED)
+ TEST(pref_MULTI1 bar foo bar)
+ TEST(pref_MULTI2 UNDEFINED)
+ TEST(pref_UNPARSED_ARGUMENTS UNDEFINED)
+endfunction()
+test1(OPT1 SINGLE1 "foo;bar" MULTI1 bar foo bar)
+
+function(test2 arg1)
+ cmake_parse_arguments(PARSE_ARGV 1
+ pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2")
+
+ TEST(arg1 "first named")
+ TEST(pref_OPT1 TRUE)
+ TEST(pref_OPT2 FALSE)
+ TEST(pref_SINGLE1 "foo;bar")
+ TEST(pref_SINGLE2 UNDEFINED)
+ TEST(pref_MULTI1 bar foo bar)
+ TEST(pref_MULTI2 UNDEFINED)
+ TEST(pref_UNPARSED_ARGUMENTS UNDEFINED)
+endfunction()
+test2("first named" OPT1 SINGLE1 "foo;bar" MULTI1 bar foo bar)
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt
new file mode 100644
index 0000000..e44ab4d
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at BadArgvN1.cmake:[0-9]+ \(cmake_parse_arguments\):
+ PARSE_ARGV must be called with exactly 6 arguments.
+Call Stack \(most recent call first\):
+ BadArgvN1.cmake:[0-9]+ \(test1\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake
new file mode 100644
index 0000000..f894130
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake
@@ -0,0 +1,4 @@
+function(test1)
+ cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "" extra)
+endfunction()
+test1()
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt
new file mode 100644
index 0000000..1dde86d
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at BadArgvN2.cmake:[0-9]+ \(cmake_parse_arguments\):
+ PARSE_ARGV index 'pref' is not an unsigned integer
+Call Stack \(most recent call first\):
+ BadArgvN2.cmake:[0-9]+ \(test2\)
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake
new file mode 100644
index 0000000..d20c2c8
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake
@@ -0,0 +1,4 @@
+function(test2)
+ cmake_parse_arguments(PARSE_ARGV pref "" "" "" extra)
+endfunction()
+test2()
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt
new file mode 100644
index 0000000..5a30dc9
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at BadArgvN3.cmake:[0-9]+ \(cmake_parse_arguments\):
+ PARSE_ARGV called with ARGC='' that is not an unsigned integer
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake
new file mode 100644
index 0000000..8fb3fdd
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake
@@ -0,0 +1 @@
+cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "")
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt
new file mode 100644
index 0000000..f4bdac4
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at BadArgvN4.cmake:[0-9]+ \(cmake_parse_arguments\):
+ PARSE_ARGV called with ARGV0 not set
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake
new file mode 100644
index 0000000..b887a28
--- /dev/null
+++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake
@@ -0,0 +1,3 @@
+set(ARGC 1)
+cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "")
+unset(ARGC)
diff --git a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake
index b89f1a5..22d7ee4 100644
--- a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake
@@ -5,3 +5,8 @@ run_cmake(Initialization)
run_cmake(Mix)
run_cmake(CornerCases)
run_cmake(Errors)
+run_cmake(ArgvN)
+run_cmake(BadArgvN1)
+run_cmake(BadArgvN2)
+run_cmake(BadArgvN3)
+run_cmake(BadArgvN4)
diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt
diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt
new file mode 100644
index 0000000..82a78c9
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\):
+ Unexpected argument: JUNK
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake
new file mode 100644
index 0000000..2e3fbe1
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake
@@ -0,0 +1,5 @@
+file(DOWNLOAD
+ "file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt"
+ JUNK
+ )
diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 5f85bba..4c05f24 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -1,6 +1,8 @@
include(RunCMake)
run_cmake(DOWNLOAD-hash-mismatch)
+run_cmake(DOWNLOAD-unused-argument)
+run_cmake(UPLOAD-unused-argument)
run_cmake(INSTALL-DIRECTORY)
run_cmake(INSTALL-MESSAGE-bad)
run_cmake(FileOpenFailRead)
diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt
diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt
new file mode 100644
index 0000000..3c1b744
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning \(dev\) at UPLOAD-unused-argument.cmake:[0-9]+ \(file\):
+ Unexpected argument: JUNK
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.cmake b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake
new file mode 100644
index 0000000..94ac9ac
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake
@@ -0,0 +1,5 @@
+file(UPLOAD
+ "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-unused-argument.txt"
+ "file://${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt"
+ JUNK
+ )
diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.txt b/Tests/RunCMake/file/UPLOAD-unused-argument.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-unused-argument.txt