Tests: Test add_custom_command and add_custom_target error cases

Add RunCMake.add_custom_command and RunCMake.add_custom_target tests to
cover the error messages for these commands.
This commit is contained in:
Brad King 2014-11-13 12:46:49 -05:00
parent 0b3b54e21f
commit 39baf728b7
29 changed files with 85 additions and 0 deletions

View File

@ -95,6 +95,8 @@ endif()
add_RunCMake_test(CompatibleInterface)
add_RunCMake_test(Syntax)
add_RunCMake_test(add_custom_command)
add_RunCMake_test(add_custom_target)
add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command)
add_RunCMake_test(export)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at AppendNoOutput.cmake:1 \(add_custom_command\):
add_custom_command given APPEND option with no OUTPUT.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command(TARGET x APPEND DEPENDS a b c d)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\):
add_custom_command given APPEND option with output.*
which is not already a custom command output.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command(OUTPUT out APPEND DEPENDS dep)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at BadArgument.cmake:1 \(add_custom_command\):
add_custom_command Wrong syntax. Unknown type of argument.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command(bad_arg OUTPUT a b c d)

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.1)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at NoArguments.cmake:1 \(add_custom_command\):
add_custom_command called with wrong number of arguments.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command()

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at NoOutputOrTarget.cmake:1 \(add_custom_command\):
add_custom_command Wrong syntax. A TARGET or OUTPUT must be specified.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command(COMMAND echo a b c d)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
CMake Error at OutputAndTarget.cmake:1 \(add_custom_command\):
add_custom_command Wrong syntax. A TARGET and OUTPUT can not both be
specified.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_command(OUTPUT out TARGET target)

View File

@ -0,0 +1,8 @@
include(RunCMake)
run_cmake(AppendNoOutput)
run_cmake(AppendNotOutput)
run_cmake(BadArgument)
run_cmake(NoArguments)
run_cmake(NoOutputOrTarget)
run_cmake(OutputAndTarget)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,17 @@
CMake Error at BadTargetName.cmake:1 \(add_custom_target\):
add_custom_target called with target name containing a "#". This character
is not allowed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetName.cmake:2 \(add_custom_target\):
add_custom_target called with target name containing a "<". This character
is not allowed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
CMake Error at BadTargetName.cmake:3 \(add_custom_target\):
add_custom_target called with target name containing a ">". This character
is not allowed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1,3 @@
add_custom_target("#")
add_custom_target("<")
add_custom_target(">")

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.1)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at NoArguments.cmake:1 \(add_custom_target\):
add_custom_target called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
add_custom_target()

View File

@ -0,0 +1,4 @@
include(RunCMake)
run_cmake(NoArguments)
run_cmake(BadTargetName)