Changeset 103458 in vbox for trunk/src/libs/xpcom18a4/xpcom/tests
- Timestamp:
- Feb 19, 2024 5:00:08 PM (12 months ago)
- svn:sync-xref-src-repo-rev:
- 161792
- Location:
- trunk/src/libs/xpcom18a4/xpcom/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/tests/TestCRT.cpp
r103140 r103458 41 41 #include <stdlib.h> 42 42 43 #ifdef DEBUG 43 44 // The return from strcmp etc is only defined to be postive, zero or 44 45 // negative. The magnitude of a non-zero return is irrelevant. … … 53 54 } 54 55 } 55 56 #endif 56 57 57 58 // Verify that nsCRT versions of string comparison routines get the -
trunk/src/libs/xpcom18a4/xpcom/tests/nsIFileTest.cpp
r103140 r103458 15 15 #include "nsCOMPtr.h" 16 16 17 static void Passed();18 17 static void Failed(const char* explanation = nsnull); 19 static void Inspect();20 18 static void Banner(const char* bannerString); 21 19 … … 38 36 39 37 //---------------------------------------------------------------------------- 40 static void Passed()41 //----------------------------------------------------------------------------42 {43 printf("Test passed.");44 }45 46 //----------------------------------------------------------------------------47 38 static void Failed(const char* explanation) 48 39 //---------------------------------------------------------------------------- … … 50 41 printf("ERROR : Test failed.\n"); 51 42 printf("REASON: %s.\n", explanation); 52 }53 54 //----------------------------------------------------------------------------55 static void Inspect()56 //----------------------------------------------------------------------------57 {58 printf("^^^^^^^^^^ PLEASE INSPECT OUTPUT FOR ERRORS\n");59 43 } 60 44 … … 171 155 172 156 } 173 174 static void CreateUniqueTest(const char* creationPath, const char* appendPath,175 PRInt32 whatToCreate, PRInt32 perm)176 {177 nsresult rv;178 nsCOMPtr<nsILocalFile> file =179 do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);180 181 if (NS_FAILED(rv) || (!file))182 {183 printf("create nsILocalFile failed\n");184 return;185 }186 187 Banner("Creation Test");188 printf("creationPath == %s\nappendPath == %s\n", creationPath, appendPath);189 190 rv = file->InitWithNativePath(nsDependentCString(creationPath));191 VerifyResult(rv);192 193 printf("Appending %s\n", appendPath);194 rv = file->AppendNative(nsDependentCString(appendPath));195 VerifyResult(rv);196 197 printf("Check For Existence\n");198 199 PRBool exists;200 file->Exists(&exists);201 202 if (exists)203 printf("Yup!\n");204 else205 printf("no.\n");206 207 208 rv = file->CreateUnique(whatToCreate, perm);209 VerifyResult(rv);210 211 rv = file->Exists(&exists);212 VerifyResult(rv);213 214 215 if (!exists)216 {217 Failed("Did not create file system object!");218 return;219 }220 221 }222 223 157 224 158 static void CopyTest(const char *testFile, const char *targetDir) … … 423 357 registrar->AutoRegister(nsnull); 424 358 425 #if defined(XP_WIN) || defined(XP_OS2)426 InitTest("c:\\temp\\", "sub1/sub2/"); // expect failure427 InitTest("d:\\temp\\", "sub1\\sub2\\"); // expect failure428 429 CreationTest("c:\\temp\\", "file.txt", nsIFile::NORMAL_FILE_TYPE, 0644);430 DeletionTest("c:\\temp\\", "file.txt", PR_FALSE);431 432 MoveTest("c:\\newtemp\\", "d:");433 434 CreationTest("c:\\temp\\", "mumble\\a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\", nsIFile::DIRECTORY_TYPE, 0644);435 DeletionTest("c:\\temp\\", "mumble", PR_TRUE);436 437 CreateUniqueTest("c:\\temp\\", "foo", nsIFile::NORMAL_FILE_TYPE, 0644);438 CreateUniqueTest("c:\\temp\\", "foo", nsIFile::NORMAL_FILE_TYPE, 0644);439 CreateUniqueTest("c:\\temp\\", "bar.xx", nsIFile::DIRECTORY_TYPE, 0644);440 CreateUniqueTest("c:\\temp\\", "bar.xx", nsIFile::DIRECTORY_TYPE, 0644);441 DeletionTest("c:\\temp\\", "foo", PR_TRUE);442 DeletionTest("c:\\temp\\", "foo-1", PR_TRUE);443 DeletionTest("c:\\temp\\", "bar.xx", PR_TRUE);444 DeletionTest("c:\\temp\\", "bar-1.xx", PR_TRUE);445 446 #else447 #ifdef XP_UNIX448 359 InitTest("/tmp/", "sub1/sub2/"); // expect failure 449 360 … … 465 376 DeletionTest("/tmp", "foo", PR_TRUE); 466 377 467 #endif /* XP_UNIX */468 #endif /* XP_WIN || XP_OS2 */469 378 return 0; 470 379 }
Note:
See TracChangeset
for help on using the changeset viewer.