Index: test/cctest/test-flags.cc |
diff --git a/test/cctest/test-flags.cc b/test/cctest/test-flags.cc |
index 32f1264f7f1ab7a8fd783596ca60dbeff1f0d1e8..9cb12c4787f59995e6807e7cdae2d52fdfa57824 100644 |
--- a/test/cctest/test-flags.cc |
+++ b/test/cctest/test-flags.cc |
@@ -159,7 +159,7 @@ TEST(Flags6) { |
CHECK_EQ(3, FlagList::SetFlagsFromCommandLine(&argc, |
const_cast<char **>(argv), |
true)); |
- CHECK_EQ(4, argc); |
+ CHECK_EQ(2, argc); |
} |
@@ -232,3 +232,16 @@ TEST(FlagsJSArguments4) { |
CHECK_EQ(0, FLAG_js_arguments.argc()); |
} |
+ |
+TEST(FlagsRemoveIncomplete) { |
+ // Test that processed command line arguments are removed, even |
+ // if the list of arguments ends unexpectedly. |
+ SetFlagsToDefault(); |
+ int argc = 3; |
+ const char* argv[] = { "", "--crankshaft", "--expose-debug-as" }; |
+ CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc, |
+ const_cast<char **>(argv), |
+ true)); |
+ CHECK_NE(NULL, argv[1]); |
+ CHECK_EQ(argc, 2); |
+} |