Просмотр исходного кода

When running only a single test, do not (by default) overwrite the default
HTML output file, but issue an error instead.


[SVN r8592]

Jens Maurer 25 лет назад
Родитель
Сommit
fd1d9af97f
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      libs/regression.cpp

+ 7 - 0
libs/regression.cpp

@@ -101,6 +101,7 @@ struct configuration
 configuration parse_command_line(char **first, char **last)
 configuration parse_command_line(char **first, char **last)
 {
 {
   configuration cfg;
   configuration cfg;
+  bool output_redirected = false;
   for( ; first != last; ++first) {
   for( ; first != last; ++first) {
     std::string arg = *first;
     std::string arg = *first;
     if(arg == "--config") {
     if(arg == "--config") {
@@ -111,6 +112,7 @@ configuration parse_command_line(char **first, char **last)
       cfg.boostpath = *++first;
       cfg.boostpath = *++first;
     } else if(arg == "-o" || arg == "--output") {
     } else if(arg == "-o" || arg == "--output") {
       cfg.html_output = *++first;
       cfg.html_output = *++first;
+      output_redirected = true;
     } else if(arg == "--compiler") {
     } else if(arg == "--compiler") {
       cfg.compiler = *++first;
       cfg.compiler = *++first;
     } else if(arg.substr(0,1) == "-") {
     } else if(arg.substr(0,1) == "-") {
@@ -132,6 +134,11 @@ configuration parse_command_line(char **first, char **last)
       break;
       break;
     }
     }
   }
   }
+  if(cfg.test != "" && !output_redirected) {
+    std::cerr << "Error: Please specify the HTML output file explicitly\n"
+	      << "(using \"--output file\") when running a single test only.\n";
+    std::exit(1);
+  }
   return cfg;
   return cfg;
 }
 }
 
 

粤ICP备19079148号