Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1885)

Unified Diff: test/cctest/test-flags.cc

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-flags.cc
===================================================================
--- test/cctest/test-flags.cc (revision 746)
+++ test/cctest/test-flags.cc (working copy)
@@ -168,3 +168,67 @@
const char* str = " --testing-int-flag 0 --testing_float_flag ";
CHECK_EQ(3, FlagList::SetFlagsFromString(str, strlen(str)));
}
+
+
+TEST(FlagsJSArguments1) {
+ SetFlagsToDefault();
+ int argc = 6;
+ const char* argv[] = {"TestJSArgs1",
+ "--testing-int-flag", "42",
+ "--", "testing-float-flag", "7"};
+ CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
+ const_cast<char **>(argv),
+ true));
+ CHECK_EQ(42, FLAG_testing_int_flag);
+ CHECK_EQ(2.5, FLAG_testing_float_flag);
+ CHECK_EQ(2, FLAG_js_arguments.argc());
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[0], "testing-float-flag"));
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[1], "7"));
+ CHECK_EQ(1, argc);
+}
+
+
+TEST(FlagsJSArguments1b) {
+ SetFlagsToDefault();
+ const char* str = "--testing-int-flag 42 -- testing-float-flag 7";
+ CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
+ CHECK_EQ(42, FLAG_testing_int_flag);
+ CHECK_EQ(2.5, FLAG_testing_float_flag);
+ CHECK_EQ(2, FLAG_js_arguments.argc());
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[0], "testing-float-flag"));
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[1], "7"));
+}
+
+
+TEST(FlagsJSArguments2) {
+ SetFlagsToDefault();
+ const char* str = "--testing-int-flag 42 --js-arguments testing-float-flag 7";
+ CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
+ CHECK_EQ(42, FLAG_testing_int_flag);
+ CHECK_EQ(2.5, FLAG_testing_float_flag);
+ CHECK_EQ(2, FLAG_js_arguments.argc());
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[0], "testing-float-flag"));
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[1], "7"));
+}
+
+
+TEST(FlagsJSArguments3) {
+ SetFlagsToDefault();
+ const char* str = "--testing-int-flag 42 --js-arguments=testing-float-flag 7";
+ CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
+ CHECK_EQ(42, FLAG_testing_int_flag);
+ CHECK_EQ(2.5, FLAG_testing_float_flag);
+ CHECK_EQ(2, FLAG_js_arguments.argc());
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[0], "testing-float-flag"));
+ CHECK_EQ(0, strcmp(FLAG_js_arguments[1], "7"));
+}
+
+
+TEST(FlagsJSArguments4) {
+ SetFlagsToDefault();
+ const char* str = "--testing-int-flag 42 --";
+ CHECK_EQ(0, FlagList::SetFlagsFromString(str, strlen(str)));
+ CHECK_EQ(42, FLAG_testing_int_flag);
+ CHECK_EQ(0, FLAG_js_arguments.argc());
+}
+
« no previous file with comments | « test/cctest/test-disasm-arm.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698