Пример #1
0
int main(void)
{
    nsCOMPtr<nsIServiceManager> servMan;
    NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
    nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
    NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
    registrar->AutoRegister(nsnull);
  
#if defined(XP_WIN) || defined(XP_OS2)
    InitTest("c:\\temp\\", "sub1/sub2/"); // expect failure
    InitTest("d:\\temp\\", "sub1\\sub2\\"); // expect failure

    CreationTest("c:\\temp\\", "file.txt", nsIFile::NORMAL_FILE_TYPE, 0644);
    DeletionTest("c:\\temp\\", "file.txt", PR_FALSE);

    MoveTest("c:\\newtemp\\", "d:");

    CreationTest("c:\\temp\\", "mumble\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\", nsIFile::DIRECTORY_TYPE, 0644);
    DeletionTest("c:\\temp\\", "mumble", PR_TRUE);

    CreateUniqueTest("c:\\temp\\", "foo", nsIFile::NORMAL_FILE_TYPE, 0644);
    CreateUniqueTest("c:\\temp\\", "foo", nsIFile::NORMAL_FILE_TYPE, 0644);
    CreateUniqueTest("c:\\temp\\", "bar.xx", nsIFile::DIRECTORY_TYPE, 0644);
    CreateUniqueTest("c:\\temp\\", "bar.xx", nsIFile::DIRECTORY_TYPE, 0644);
    DeletionTest("c:\\temp\\", "foo", PR_TRUE);
    DeletionTest("c:\\temp\\", "foo-1", PR_TRUE);
    DeletionTest("c:\\temp\\", "bar.xx", PR_TRUE);
    DeletionTest("c:\\temp\\", "bar-1.xx", PR_TRUE);

#else
#ifdef XP_UNIX
    InitTest("/tmp/", "sub1/sub2/"); // expect failure
    
    CreationTest("/tmp", "file.txt", nsIFile::NORMAL_FILE_TYPE, 0644);
    DeletionTest("/tmp/", "file.txt", PR_FALSE);
    
    CreationTest("/tmp", "mumble/a/b/c/d/e/f/g/h/i/j/k/", nsIFile::DIRECTORY_TYPE, 0644);
    DeletionTest("/tmp", "mumble", PR_TRUE);

    CreationTest("/tmp", "file", nsIFile::NORMAL_FILE_TYPE, 0644);
    CopyTest("/tmp/file", "/tmp/newDir");
    MoveTest("/tmp/file", "/tmp/newDir/anotherNewDir");
    DeletionTest("/tmp", "newDir", PR_TRUE);

#endif /* XP_UNIX */
#endif /* XP_WIN || XP_OS2 */
    return 0;
}
Пример #2
0
void PointerListTest::Run() 
{
	CreationTest();	
	OwningTest();
	SortTest();
	SortTestWithState();
	EachElementTest();
	BinarySearchTest();
	BinarySearchIndexTest();
	NullTest();
}