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:
Tyler Dauwalder
2002-07-17 10:50:55 +00:00
parent cbe085bc5a
commit d1f6c38f0d
26 changed files with 890 additions and 585 deletions
+20 -4
View File
@@ -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);
}