Files Classes Functions Hierarchy
#include <projunittest.h>
Public Member Functions | |
| unittestcmd () | |
| Bad state. | |
| unittestcmd (stringc &line_) | |
| Not evaluated. | |
| int | eval () |
| Execute the command in the shell. | |
| stringc | xml () const |
| Write as xml. | |
Public Attributes | |
| projprint | terminal |
| Print mode. | |
| string | line |
| Invoked at shell. | |
| string | output |
| First few lines out output. | |
Static Public Attributes | |
| static string | tempfile = "/tmp/projunittestcmdtemp.txt" |
| Tempory file. | |
Definition at line 25 of file projunittest.h.
| unittestcmd::unittestcmd | ( | ) |
| unittestcmd::unittestcmd | ( | stringc & | line_ | ) |
| int unittestcmd::eval | ( | ) |
Execute the command in the shell.
Definition at line 19 of file projunittest.cpp.
References systemcalls::combine, systemcalls::eval(), exitint::exitstatus, projprint::isall(), projprint::issummary(), systemcalls::output(), output, tempfile, and terminal.
00020 { 00021 //cout << SHOW3(line) << endl; 00022 assert(line.empty()==false); 00023 00024 stringc cmdline("$ " + line + "\n"); 00025 00026 if (terminal.isall()) 00027 cout << cmdline; 00028 00029 { 00030 systemcalls sys(line,tempfile); 00031 sys.combine=true; 00032 exitstatus=sys.eval(); 00033 00034 // Summary takes the first few lines only. 00035 //if (printstate!=summary) 00036 if (!terminal.issummary()) 00037 output= sys.output(); 00038 } 00039 //cout << SHOW3(exitstatus) << endl; 00040 //cout << SHOW3(printstate) << endl; 00041 00042 if (terminal.issummary()) 00043 { 00044 00045 systemcalls sys2("head -n 15 " + tempfile); 00046 sys2.combine=true; 00047 sys2.eval(); 00048 output= sys2.output(); 00049 //cout << SHOW(output) << endl; 00050 } 00051 00052 //if (printstate==all) 00053 if (terminal.isall()) 00054 cout << output << endl; 00055 00056 return exitstatus; 00057 }
| stringc unittestcmd::xml | ( | ) | const |
Write as xml.
Definition at line 59 of file projunittest.cpp.
References exitint::exitstatus, output, and stringtag().
00060 { 00061 string s1; 00062 s1 += stringtag(exitstatus,"exitstatus"); 00063 s1 += stringtag(line,"line"); 00064 s1 += stringtag(output,"output"); 00065 00066 return s1=stringtag(s1,"cmd"); 00067 }
| string unittestcmd::line |
| string unittestcmd::output |
string unittestcmd::tempfile = "/tmp/projunittestcmdtemp.txt" [static] |
1.5.8