mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 22:30:07 -05:00
Merge topic 'list-command-argument-fixes'
08c71acCMake.List test: explicitely test with lists containing only an empty string52d9c38list command: error on too many arguments
This commit is contained in:
@@ -429,6 +429,12 @@ bool cmListCommand
|
||||
this->SetError("sub-command REVERSE requires a list as an argument.");
|
||||
return false;
|
||||
}
|
||||
else if(args.size() > 2)
|
||||
{
|
||||
this->SetError(
|
||||
"sub-command REVERSE only takes one argument.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& listName = args[1];
|
||||
// expand the variable
|
||||
@@ -463,6 +469,12 @@ bool cmListCommand
|
||||
"sub-command REMOVE_DUPLICATES requires a list as an argument.");
|
||||
return false;
|
||||
}
|
||||
else if(args.size() > 2)
|
||||
{
|
||||
this->SetError(
|
||||
"sub-command REMOVE_DUPLICATES only takes one argument.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& listName = args[1];
|
||||
// expand the variable
|
||||
@@ -506,6 +518,12 @@ bool cmListCommand
|
||||
this->SetError("sub-command SORT requires a list as an argument.");
|
||||
return false;
|
||||
}
|
||||
else if(args.size() > 2)
|
||||
{
|
||||
this->SetError(
|
||||
"sub-command SORT only takes one argument.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& listName = args[1];
|
||||
// expand the variable
|
||||
|
||||
@@ -86,3 +86,14 @@ TEST("REVERSE result" "ken;brad;bill;andy")
|
||||
set(result bill andy bill brad ken ken ken)
|
||||
list(REMOVE_DUPLICATES result)
|
||||
TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken")
|
||||
|
||||
# these commands should just do nothing if the list is already empty
|
||||
set(result "")
|
||||
list(REMOVE_DUPLICATES result)
|
||||
TEST("REMOVE_DUPLICATES empty result" "")
|
||||
|
||||
list(REVERSE result)
|
||||
TEST("REVERSE empty result" "")
|
||||
|
||||
list(SORT result)
|
||||
TEST("SORT empty result" "")
|
||||
|
||||
Reference in New Issue
Block a user