From cb2a9be622d612c462ec901bce6a5bab7b1462d7 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 15 May 2006 09:57:49 -0400 Subject: ENH: Change REMOVE and REMOVE_ITEM to REMOVE_AT and REMOVE_ITEM --- Source/cmListCommand.cxx | 10 +++++----- Source/cmListCommand.h | 10 +++++----- Tests/CMakeTests/ListTest.cmake.in | 18 +++++++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index e671b6b..1e8b7eb 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -46,9 +46,9 @@ bool cmListCommand::InitialPass(std::vector const& args) { return this->HandleInsertCommand(args); } - if(subCommand == "REMOVE") + if(subCommand == "REMOVE_AT") { - return this->HandleRemoveCommand(args); + return this->HandleRemoveAtCommand(args); } if(subCommand == "REMOVE_ITEM") { @@ -250,7 +250,8 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) } //---------------------------------------------------------------------------- -bool cmListCommand::HandleRemoveCommand(std::vector const& args) +bool cmListCommand +::HandleRemoveItemCommand(std::vector const& args) { if(args.size() < 3) { @@ -295,8 +296,7 @@ bool cmListCommand::HandleRemoveCommand(std::vector const& args) } //---------------------------------------------------------------------------- -bool cmListCommand -::HandleRemoveItemCommand(std::vector const& args) +bool cmListCommand::HandleRemoveAtCommand(std::vector const& args) { if(args.size() < 3) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 779b6bd..fc91bad 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -69,8 +69,8 @@ public: ")\n" " LIST(APPEND [ ...])\n" " LIST(INSERT [ ...])\n" - " LIST(REMOVE [ ...])\n" - " LIST(REMOVE_ITEM [ ...])\n" + " LIST(REMOVE_ITEM [ ...])\n" + " LIST(REMOVE_AT [ ...])\n" " LIST(SORT )\n" " LIST(REVERSE )\n" "LENGTH will return a given list's length.\n" @@ -79,8 +79,8 @@ public: "INSERT will insert elements to the list to the specified location.\n" "When specifying an index, negative value corresponds to index from the" " end of the list.\n" - "REMOVE and REMOVE_ITEM will remove item from the list. The difference " - "is that REMOVE will remove the given items, while REMOVE_ITEM will " + "REMOVE_AT and REMOVE_ITEM will remove item from the list. The difference " + "is that REMOVE_ITEM will remove the given items, while REMOVE_AT will " "remove the item at the given indices.\n" ; } @@ -91,7 +91,7 @@ protected: bool HandleGetCommand(std::vector const& args); bool HandleAppendCommand(std::vector const& args); bool HandleInsertCommand(std::vector const& args); - bool HandleRemoveCommand(std::vector const& args); + bool HandleRemoveAtCommand(std::vector const& args); bool HandleRemoveItemCommand(std::vector const& args); diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index d1e8c2b..9e72d14 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -2,7 +2,7 @@ MACRO(TEST command expected) IF("x${result}" STREQUAL "x${expected}") MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") ELSE("x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") ENDIF("x${result}" STREQUAL "x${expected}") ENDMACRO(TEST command expected) @@ -48,13 +48,17 @@ LIST(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") SET(result andy bill brad ken bob) -LIST(REMOVE result bob) -TEST("REMOVE result bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE result peter bob) -TEST("REMOVE result peter bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result peter bob) +TEST("REMOVE_ITEM result peter bob" "andy;bill;brad;ken") + +SET(result bob andy bill bob brad ken bob) +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE_ITEM result 2 -1) -TEST("REMOVE_ITEM result 2 -1" "andy;bill;brad;ken") +LIST(REMOVE_AT result 2 -1) +TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken") -- cgit v0.12