pike.git / bin / test_pike.pike

version» Context lines:

pike.git/bin/test_pike.pike:1:   #!/usr/local/bin/pike    - /* $Id: test_pike.pike,v 1.29 1999/10/22 02:35:41 hubbe Exp $ */ + /* $Id: test_pike.pike,v 1.30 1999/10/29 00:13:38 hubbe Exp $ */      import Stdio;      #if !constant(_verify_internals)   #define _verify_internals()   #endif      #if !constant(_dmalloc_set_name)   void _dmalloc_set_name(mixed ... args) {}   #endif
pike.git/bin/test_pike.pike:222:       shift++;    shift%=3;    string fname = argv[f] + ": Test " + (e + 1) +    " (shift " + shift + ")";       string widener = ([ 0:"",    1:"\nint \x30c6\x30b9\x30c8=0;\n",    2:"\nint \x10001=0;\n" ])[shift%3];    +  if(test[-1]!='\n') test+="\n"; +  +  int computed_line=sizeof(test/"\n"); +  array gnapp= test/"#"; +  for(int e=0;e<sizeof(gnapp);e++) +  { +  if(sscanf(gnapp[e],"%*d")) +  { +  computed_line=0; +  break; +  } +  } +  string linetester="int __cpp_line=__LINE__; int __rtl_line=backtrace()[-1][1];\n"; +  +  string to_compile = test + linetester + widener;    switch(type)    {    case "COMPILE":    _dmalloc_set_name(fname,0); -  if(catch(compile_string(test + widener, fname))) +  if(catch(compile_string(to_compile, fname)))    {    _dmalloc_set_name();    werror(fname + " failed.\n");    bzot(test);    errors++;    }else{    _dmalloc_set_name();    successes++;    }    break;       case "COMPILE_ERROR":    master()->set_inhibit_compile_errors(1);    _dmalloc_set_name(fname,0); -  if(catch(compile_string(test + widener, fname))) +  if(catch(compile_string(to_compile, fname)))    {    _dmalloc_set_name();    successes++;    }else{    _dmalloc_set_name();    werror(fname + " failed.\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); -  if(catch(clone(compile_string(test + widener, fname))->a())) +  if(catch(clone(compile_string(to_compile, fname))->a()))    {    _dmalloc_set_name();    successes++;    }else{    _dmalloc_set_name();    werror(fname + " failed.\n");    bzot(test);    errors++;    }    master()->set_inhibit_compile_errors(0);    break;       default:    mixed err;    if (err = catch{    _dmalloc_set_name(fname,0); -  o=clone(compile_string(test + widener,fname)); +  o=clone(compile_string(to_compile,fname));    _dmalloc_set_name();       if(check > 1) _verify_internals();       a=b=0;    if(t) trace(t);    _dmalloc_set_name(fname,1);    if(functionp(o->a)) a=o->a();    if(functionp(o->b)) b=o->b();    _dmalloc_set_name();       if(t) trace(0);    if(check > 1) _verify_internals(); -  +     }) {    werror(fname + " failed.\n");    bzot(test);    if (arrayp(err) && sizeof(err) && stringp(err[0])) {    werror("Error: " + master()->describe_backtrace(err));    }    if (objectp(err)) {    werror("Error: " + master()->describe_backtrace(err));    }    errors++;    break;    }    -  +  if( o->__cpp_line != o->__rtl_line || +  ( computed_line && computed_line!=o->__cpp_line)) +  { +  werror(fname + " Line numbering failed.\n"); +  bzot(test + linetester); +  werror(" CPP lines: %d\n",o->__cpp_line); +  werror(" RTL lines: %d\n",o->__rtl_line); +  if(computed_line) +  werror("Actual lines: %d\n",computed_line); +  errors++; +  } +     switch(type)    {    case "FALSE":    if(a)    {    werror(fname + " failed.\n");    bzot(test);    werror(sprintf("o->a(): %O\n",a));    errors++;    }else{