Branch: Tag:

2000-01-30

2000-01-30 23:44:40 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

better output for non-terminals

Rev: bin/test_pike.pike:1.32

1:   #!/usr/local/bin/pike    - /* $Id: test_pike.pike,v 1.31 1999/12/10 00:51:43 grubba Exp $ */ + /* $Id: test_pike.pike,v 1.32 2000/01/30 23:44:40 hubbe Exp $ */      import Stdio;   
18:    return (int)opt;   }    + int istty_cache; + int istty() + { + #ifdef __NT__ +  return 1; + #else +  if(!istty_cache) +  { +  istty_cache=!!Stdio.stdin->tcgetattr(); +  if(!istty_cache) istty_cache=-1; +  } +  return istty_cache>0; + #endif + } +    mapping(string:int) cond_cache=([]);      #if constant(thread_create)
96:    ({"check",Getopt.MAY_HAVE_ARG,({"-c","--check"})}),    ({"mem",Getopt.MAY_HAVE_ARG,({"-m","--mem","--memory"})}),    ({"auto",Getopt.MAY_HAVE_ARG,({"-a","--auto"})}), +  ({"notty",Getopt.NO_ARG,({"-t","--notty"})}),   #ifdef HAVE_DEBUG    ({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}),   #endif
103:    {    switch(opt[0])    { +  case "notty": +  istty_cache=-1; +  break; +     case "help":    werror("Usage: "+argv[e]+" [-v | --verbose] [-h | --help] [-t <testno>] <testfile>\n");    return 0;
175:       for(e=start;e<sizeof(tests);e++)    { +  if(istty()) +  {    werror("%6d\r",e+1); -  +  }else{ +  switch( (e-start) % 50) +  { +  case 0: +  werror("%5d: ",e); +  break;    -  +  case 9: +  case 19: +  case 29: +  case 39: +  werror(". "); +  break; +  +  default: +  werror("."); +  break; +  +  case 49: +  werror(".\n"); +  } +  } +     string test,condition;    string|int type;    object o;
409:       a=b=0;    } +  +  if(istty()) +  {    werror(" \r"); -  +  }else{ +  werror("\n");    } -  +  }    if(mem)    {    int total;