Unit testing update:
- Verbosity is now honored globally - Added BTestCase::Outputf() - Migrated BNode, BStatable, BDirectory, and BPath tests - Added CommonTestLib, TestLib, and R5TestLib rules to Jamrules - Updated Jamfiles for unit testing stuff - Probably a few other things I've forgotten git-svn-id: file:///srv/svn/repos/haiku/trunk/current@269 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <TestShell.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
BTestCase::BTestCase(std::string name)
|
||||
: CppUnit::TestCase(name)
|
||||
@@ -17,8 +18,7 @@ BTestCase::tearDown() {
|
||||
|
||||
void
|
||||
BTestCase::NextSubTest() {
|
||||
BTestShell *shell = BTestShell::Shell();
|
||||
if (shell && shell->BeVerbose()) {
|
||||
if (BeVerbose()) {
|
||||
printf("[%ld]", fSubTestNum++);
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -26,11 +26,21 @@ BTestCase::NextSubTest() {
|
||||
|
||||
void
|
||||
BTestCase::NextSubTestBlock() {
|
||||
BTestShell *shell = BTestShell::Shell();
|
||||
if (shell && shell->BeVerbose())
|
||||
if (BeVerbose())
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
BTestCase::Outputf(const char *str, ...) {
|
||||
if (BeVerbose()) {
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
vprintf(str, args);
|
||||
va_end(args);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/*! To return to the last saved working directory, call RestoreCWD(). */
|
||||
void
|
||||
BTestCase::SaveCWD() {
|
||||
@@ -49,3 +59,9 @@ BTestCase::RestoreCWD(const char *alternate) {
|
||||
else if (alternate != NULL)
|
||||
chdir(alternate);
|
||||
}
|
||||
|
||||
bool
|
||||
BTestCase::BeVerbose() {
|
||||
BTestShell *shell = BTestShell::Shell();
|
||||
return ((shell && shell->BeVerbose()) || !shell);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user