nsIFileTest.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
#include "nsILocalFile.h"
#include "nsString.h"
#include <stdio.h>
#include "nsXPCOM.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsIMemory.h"
#include "nsXPIDLString.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");
}
{
(void**)&file);
{
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");
}
{
(void **)getter_AddRefs(file));
{
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 **)getter_AddRefs(file));
{
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");
(void**)getter_AddRefs(file));
{
printf("create nsILocalFile failed\n");
return;
}
(void**)getter_AddRefs(dir));
{
printf("create nsILocalFile failed\n");
return;
}
printf("end copy test\n");
}
void
{
(void**)getter_AddRefs(file));
{
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");
}
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;
}