nsIFileTest.cpp revision ed0d4ccac4cbe85936511b94a907111e824fc588
#include "nsILocalFile.h"
#if 0 /* too new */
#include "nsStringGlue.h"
#else
#include "nsString.h"
#endif
#include <stdio.h>
#include "nsXPCOM.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsIMemory.h"
#include "nsComponentManagerUtils.h"
#include "nsCOMPtr.h"
void Passed();
void Inspect();
void Banner(const char* bannerString);
{
{
Failed("rv failed");
}
}
//----------------------------------------------------------------------------
void Banner(const char* bannerString)
//----------------------------------------------------------------------------
{
printf("---------------------------\n");
printf("---------------------------\n");
}
//----------------------------------------------------------------------------
void Passed()
//----------------------------------------------------------------------------
{
printf("Test passed.");
}
//----------------------------------------------------------------------------
void Failed(const char* explanation)
//----------------------------------------------------------------------------
{
printf("ERROR : Test failed.\n");
}
//----------------------------------------------------------------------------
void Inspect()
//----------------------------------------------------------------------------
{
printf("^^^^^^^^^^ PLEASE INSPECT OUTPUT FOR ERRORS\n");
}
{
printf("Getting Path\n");
}
{
{
printf("create nsILocalFile failed\n");
return;
}
Banner("InitWithPath");
printf("Getting Filename\n");
printf("Getting Filename\n");
printf("Check For Existence\n");
if (exists)
printf("Yup!\n");
else
printf("no.\n");
}
{
{
printf("create nsILocalFile failed\n");
return;
}
Banner("Creation Test");
printf("Check For Existence\n");
if (exists)
printf("Yup!\n");
else
printf("no.\n");
if (!exists)
{
Failed("Did not create file system object!");
return;
}
}
{
{
printf("create nsILocalFile failed\n");
return;
}
Banner("Creation Test");
printf("Check For Existence\n");
if (exists)
printf("Yup!\n");
else
printf("no.\n");
if (!exists)
{
Failed("Did not create file system object!");
return;
}
}
void
{
printf("start copy test\n");
{
printf("create nsILocalFile failed\n");
return;
}
{
printf("create nsILocalFile failed\n");
return;
}
printf("end copy test\n");
}
void
{
{
printf("create nsILocalFile failed\n");
return;
}
Banner("Deletion Test");
printf("Check For Existance\n");
if (exists)
printf("Yup!\n");
else
printf("no.\n");
if (exists)
{
Failed("Did not create delete system object!");
return;
}
}
void
{
Banner("Move Test");
printf("start move test\n");
if (!file)
{
printf("create nsILocalFile failed\n");
return;
}
if (!dir)
{
printf("create nsILocalFile failed\n");
return;
}
{
printf("MoveToNative() test Failed.\n");
}
printf("end move test\n");
}
void
const char *expected)
{
Banner("Normalize Test");
if (!file)
{
printf("create nsILocalFile failed\n");
return;
}
for (int i=0; i < moveUpCount; i++)
{
}
if (!parent) {
printf("Getting parent failed!\n");
return;
}
if (!expectedFile)
{
printf("create nsILocalFile failed\n");
return;
}
printf("ERROR: Normalize() test Failed!\n");
}
printf("end normalize test.\n");
}
int main(void)
{
CreationTest("c:\\temp\\", "mumble\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\", nsIFile::DIRECTORY_TYPE, 0644);
#else
#ifdef XP_UNIX
#endif /* XP_UNIX */
#endif /* XP_WIN || XP_OS2 */
return 0;
}