Branch: Tag:

2002-05-24

2002-05-24 17:15:04 by Martin Nilsson <mani@lysator.liu.se>

Added support for compile warning tests and regression-only tests.

Rev: bin/test_pike.pike:1.65

1:   #!/usr/local/bin/pike    - /* $Id: test_pike.pike,v 1.64 2002/05/05 00:01:28 mast Exp $ */ + /* $Id: test_pike.pike,v 1.65 2002/05/24 17:15:04 nilsson Exp $ */      import Stdio;   
95:    return tests[0..sizeof(tests)-2];   }    + class WarningFlag { +  int(0..1) warning;    -  +  void compile_warning(mixed ... args) { +  warning = 1; +  } + } +    //   // Watchdog stuff   //
210:   #endif   }    + // + // Main program + //      int main(int argc, array(string) argv)   {
268: Inside #if defined(HAVE_DEBUG)
  #ifdef HAVE_DEBUG    ({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}),   #endif +  ({"regression",Getopt.NO_ARG,({"-r","--regression"})}),    )),array opt)    {    switch(opt[0])
303:    testsuites=find_testsuites(".");    break;    +  case "regression": +  add_constant("regression", 1); +  break; +    #ifdef HAVE_DEBUG    case "debug":    {
587:    master()->set_inhibit_compile_errors(0);    break;    +  case "COMPILE_WARNING": +  WarningFlag wf = WarningFlag(); +  master()->set_inhibit_compile_errors(wf); +  _dmalloc_set_name(fname,0); +  if(catch(compile_string(to_compile, testsuite))) +  { +  _dmalloc_set_name(); +  werror(pad_on_error + fname + " failed.\n"); +  bzot(test); +  errors++; +  } +  else { +  _dmalloc_set_name(); +  if( wf->warning ) +  successes++; +  else { +  werror(pad_on_error + fname + " failed (expected compile warning).\n"); +  bzot(test); +  errors++; +  } +  } +  master()->set_inhibit_compile_errors(0); +  break; +     case "EVAL_ERROR":    master()->set_inhibit_compile_errors(1);    _dmalloc_set_name(fname,0);