Skip to content
Snippets Groups Projects
Commit 619f88e8 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

better output for non-terminals

Rev: bin/test_pike.pike:1.32
parent 40360a39
No related branches found
No related tags found
No related merge requests found
#!/usr/local/bin/pike #!/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; import Stdio;
...@@ -18,6 +18,21 @@ int foo(string opt) ...@@ -18,6 +18,21 @@ int foo(string opt)
return (int)opt; 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=([]); mapping(string:int) cond_cache=([]);
#if constant(thread_create) #if constant(thread_create)
...@@ -96,6 +111,7 @@ int main(int argc, string *argv) ...@@ -96,6 +111,7 @@ int main(int argc, string *argv)
({"check",Getopt.MAY_HAVE_ARG,({"-c","--check"})}), ({"check",Getopt.MAY_HAVE_ARG,({"-c","--check"})}),
({"mem",Getopt.MAY_HAVE_ARG,({"-m","--mem","--memory"})}), ({"mem",Getopt.MAY_HAVE_ARG,({"-m","--mem","--memory"})}),
({"auto",Getopt.MAY_HAVE_ARG,({"-a","--auto"})}), ({"auto",Getopt.MAY_HAVE_ARG,({"-a","--auto"})}),
({"notty",Getopt.NO_ARG,({"-t","--notty"})}),
#ifdef HAVE_DEBUG #ifdef HAVE_DEBUG
({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}), ({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}),
#endif #endif
...@@ -103,6 +119,10 @@ int main(int argc, string *argv) ...@@ -103,6 +119,10 @@ int main(int argc, string *argv)
{ {
switch(opt[0]) switch(opt[0])
{ {
case "notty":
istty_cache=-1;
break;
case "help": case "help":
werror("Usage: "+argv[e]+" [-v | --verbose] [-h | --help] [-t <testno>] <testfile>\n"); werror("Usage: "+argv[e]+" [-v | --verbose] [-h | --help] [-t <testno>] <testfile>\n");
return 0; return 0;
...@@ -174,8 +194,32 @@ int main(int argc, string *argv) ...@@ -174,8 +194,32 @@ int main(int argc, string *argv)
werror("Doing tests in %s (%d tests)\n",argv[f],sizeof(tests)); werror("Doing tests in %s (%d tests)\n",argv[f],sizeof(tests));
for(e=start;e<sizeof(tests);e++) for(e=start;e<sizeof(tests);e++)
{
if(istty())
{ {
werror("%6d\r",e+1); 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 test,condition;
string|int type; string|int type;
...@@ -409,7 +453,13 @@ int main(int argc, string *argv) ...@@ -409,7 +453,13 @@ int main(int argc, string *argv)
a=b=0; a=b=0;
} }
if(istty())
{
werror(" \r"); werror(" \r");
}else{
werror("\n");
}
} }
if(mem) if(mem)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment