diff options
author | Brad King <brad.king@kitware.com> | 2006-09-21 20:11:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-09-21 20:11:25 (GMT) |
commit | ca22f0f14b1c4f93f28007cb2decd221f269ab76 (patch) | |
tree | 22ad4577319bf0b0ad6d355372245bd3c2dc569b /Tests/CustomCommand/check_command_line.c.in | |
parent | b9fc06735da95cd0f96c96012dd98c7ab5be56e6 (diff) | |
download | CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.zip CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.tar.gz CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.tar.bz2 |
ENH: Adding test for non-trivial custom command line arguments. This is for bug#3786.
Diffstat (limited to 'Tests/CustomCommand/check_command_line.c.in')
-rw-r--r-- | Tests/CustomCommand/check_command_line.c.in | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/CustomCommand/check_command_line.c.in b/Tests/CustomCommand/check_command_line.c.in new file mode 100644 index 0000000..a4dbe22 --- /dev/null +++ b/Tests/CustomCommand/check_command_line.c.in @@ -0,0 +1,32 @@ +#include <stdio.h> + +const char* expected_arguments[] = +{ +@EXPECTED_ARGUMENTS@ 0 +}; + +int main(int argc, const char* argv[]) +{ + const char** a = argv+1; + const char** e = expected_arguments; + (void)argc; + for(;*a && *e; ++a, ++e) + { + if(strcmp(*a, *e) != 0) + { + fprintf(stderr, "Argument [%s] does not match expected [%s].\n", + *a, *e); + return 1; + } + else + { + printf("[%s]\n", *a); + } + } + if(*a || *e) + { + fprintf(stderr, "Number of arguments does not match expected.\n"); + return 1; + } + return 0; +} |