Andreas Raab uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ar.64.mcz ==================== Summary ==================== Name: Files-ar.64 Author: ar Time: 4 January 2010, 4:29:21 am UUID: ae2ee583-aa8e-7445-9276-bdd3a9296e25 Ancestors: Files-nice.63 Making Tests unloadable: Move Files-Tests to Tests-Files. =============== Diff against Files-nice.63 =============== Item was changed: SystemOrganization addCategory: #'Files-Directories'! SystemOrganization addCategory: #'Files-Kernel'! SystemOrganization addCategory: #'Files-System'! - SystemOrganization addCategory: #'Files-Tests'! Item was removed: - ----- Method: FileStreamTest>>testDetectFileDo (in category 'as yet unclassified') ----- - testDetectFileDo - "Mantis #1838" - - | filename | - filename := 'filestream.tst'. - - [(FileDirectory default forceNewFileNamed: filename) - nextPutAll: '42'; - close. - - FileStream - detectFile: [FileDirectory default oldFileNamed: filename] - do: [:file | - self assert: file notNil. - self deny: file closed. - self assert: file contentsOfEntireFile = '42']] - - ensure: [FileDirectory default deleteFileNamed: filename ifAbsent: [] ]! Item was removed: - ----- Method: FileDirectoryTest>>testNonExistentDirectory (in category 'existence tests') ----- - testNonExistentDirectory - - | directory parentDirectory | - directory :=FileDirectory default - directoryNamed: 'nonExistentFolder'. - self shouldnt: [directory exists] - description: 'A FileDirectory instance should know if it points to a non-existent directory.'. - - parentDirectory :=FileDirectory default. - self shouldnt: [parentDirectory directoryExists: 'nonExistentFolder'] - description: 'A FileDirectory instance should know when a directory of the given name doesn''t exist'. - ! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testSourcePointerFromFileIndexAndPosition (in category 'testing') ----- - testSourcePointerFromFileIndexAndPosition - "Test valid input ranges" - - | sf | - sf := ExpandedSourceFileArray new. - self should: [sf sourcePointerFromFileIndex: 0 andPosition: 0] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 1 andPosition: 0] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 2 andPosition: 0] raise: Error. - self should: [sf sourcePointerFromFileIndex: 0 andPosition: 3] raise: Error. - self should: [sf sourcePointerFromFileIndex: 1 andPosition: -1] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 1 andPosition: 16r1FFFFFF] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 1 andPosition: 16r2000000] raise: Error. - self should: [sf sourcePointerFromFileIndex: 3 andPosition: 0] raise: Error. - self should: [sf sourcePointerFromFileIndex: 4 andPosition: 0] raise: Error. - - self assert: 16r1000000 = (sf sourcePointerFromFileIndex: 1 andPosition: 0). - self assert: 16r1000013 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r13). - self assert: 16r1FFFFFF = (sf sourcePointerFromFileIndex: 1 andPosition: 16rFFFFFF). - self assert: 16r2000000 = (sf sourcePointerFromFileIndex: 2 andPosition: 0). - self assert: 16r2000013 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r13). - self assert: 16r2FFFFFF = (sf sourcePointerFromFileIndex: 2 andPosition: 16rFFFFFF). - self assert: 16r3000000 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1000000). - self assert: 16r3000013 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1000013). - self assert: 16r3FFFFFF = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1FFFFFF). - self assert: 16r4000000 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1000000). - self assert: 16r4000013 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1000013). - self assert: 16r4FFFFFF = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1FFFFFF) - ! Item was removed: - ClassTestCase subclass: #FileStreamTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryRootExistence (in category 'as yet unclassified') ----- - testFileDirectoryRootExistence - "Hoping that you have 'C:' of course..." - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - self assert: (FileDirectory root fileOrDirectoryExists: 'C:').! Item was removed: - ----- Method: FileDirectoryTest>>testExists (in category 'existence tests') ----- - testExists - - self should: [FileDirectory default exists] - description: 'Should know default directory exists.'. - self should: [self myAssuredDirectory exists] - description: 'Should know created directory exists.'. - - self myDirectory containingDirectory deleteDirectory: self myLocalDirectoryName. - self shouldnt: [(self myDirectory containingDirectory directoryNamed: self myLocalDirectoryName) exists] - description: 'Should know that recently deleted directory no longer exists.'.! Item was removed: - ----- Method: FileDirectoryTest>>myAssuredDirectory (in category 'resources') ----- - myAssuredDirectory - - ^self myDirectory assureExistence! Item was removed: - ----- Method: FileDirectoryTest>>tearDown (in category 'resources') ----- - tearDown - - [ self deleteDirectory ] on: Error do: [ :ex | ]! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryDirectoryEntry (in category 'as yet unclassified') ----- - testFileDirectoryDirectoryEntry - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory on: 'C:'. - self assert: fd directoryEntry notNil.! Item was removed: - ----- Method: FileDirectoryTest>>myDirectory (in category 'resources') ----- - myDirectory - - ^FileDirectory default directoryNamed: self myLocalDirectoryName! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testChangesFileAddressRange (in category 'testing') ----- - testChangesFileAddressRange - "Test file position to source pointer address translation for the changes file" - - | sf a | - sf := StandardSourceFileArray new. - (0 to: 16r1FFFFFF by: 811) do: [:e | | a2 i p | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - i := sf fileIndexFromSourcePointer: a. - self assert: i == 2. - p := sf filePositionFromSourcePointer: a. - self assert: p = e. - a2 := sf sourcePointerFromFileIndex: 2 andPosition: p. - self assert: a2 = a]. - (0 to: 16rFFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r2000000 and: 16r2FFFFFF)]. - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r4000000 and: 16r4FFFFFF)] - - - ! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testAddressRange (in category 'testing') ----- - testAddressRange - "Test source pointer to file position address translation across the full address range" - - | sf | - sf := StandardSourceFileArray new. - (16r1000000 to: 16r4FFFFFF by: 811) do: [:e | | i a p | - i := sf fileIndexFromSourcePointer: e. - p := sf filePositionFromSourcePointer: e. - a := sf sourcePointerFromFileIndex: i andPosition: p. - self assert: a = e] - ! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testFileIndexFromSourcePointer (in category 'testing') ----- - testFileIndexFromSourcePointer - "Test derivation of file index for sources or changes file from source pointers" - - | sf | - sf := StandardSourceFileArray new. - "sources file mapping" - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1000000). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1000013). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1FFFFFF). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3000000). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3000013). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3FFFFFF). - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | self assert: 1 = (sf fileIndexFromSourcePointer: e)]. - (16r3000000 to: 16r3FFFFFF by: 811) do: [:e | self assert: 1 = (sf fileIndexFromSourcePointer: e)]. - "changes file mapping" - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2000000). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2000013). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2FFFFFF). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4000000). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4000013). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4FFFFFF). - (16r2000000 to: 16r2FFFFFF by: 811) do: [:e | self assert: 2 = (sf fileIndexFromSourcePointer: e)]. - (16r4000000 to: 16r4FFFFFF by: 811) do: [:e | self assert: 2 = (sf fileIndexFromSourcePointer: e)]. - "the following numeric ranges are unused but currently produces results as follows" - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0000000). - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0000013). - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0FFFFFF) - - - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryNamed (in category 'as yet unclassified') ----- - testFileDirectoryNamed - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory root directoryNamed: 'C:'. - self assert: fd pathName = 'C:'.! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testSourcesFileAddressRange (in category 'testing') ----- - testSourcesFileAddressRange - "Test file position to source pointer address translation for the sources file" - - | sf i p a a2 | - sf := ExpandedSourceFileArray new. - (0 to: 16r1FFFFFFF by: 4093) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - i := sf fileIndexFromSourcePointer: a. - self assert: i == 1. - p := sf filePositionFromSourcePointer: a. - self assert: p = e. - a2 := sf sourcePointerFromFileIndex: 1 andPosition: p. - self assert: a2 = a]. - (0 to: 16rFFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r1000000 and: 16r1FFFFFF)]. - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r3000000 and: 16r3FFFFFF)]. - - (16r2000000 to: 16r2FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r5000000 and: 16r5FFFFFF)]. - (16r3000000 to: 16r3FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r7000000 and: 16r7FFFFFF)]. - (16r4000000 to: 16r4FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r9000000 and: 16r9FFFFFF)]. - (16r5000000 to: 16r5FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16rB000000 and: 16rBFFFFFF)]. - (16r6000000 to: 16r6FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16rD000000 and: 16rDFFFFFF)]. - (16r7000000 to: 16r7FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16rF000000 and: 16rFFFFFFF)] - ! Item was removed: - TestCase subclass: #DosFileDirectoryTests - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! Item was removed: - ----- Method: FileDirectoryTest>>testDirectoryExists (in category 'existence tests') ----- - testDirectoryExists - - self assert: self myAssuredDirectory exists. - self should: [self myDirectory containingDirectory - directoryExists: self myLocalDirectoryName]. - - self myDirectory containingDirectory deleteDirectory: self myLocalDirectoryName. - self shouldnt: [self myDirectory containingDirectory - directoryExists: self myLocalDirectoryName]! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testFilePositionFromSourcePointer (in category 'testing') ----- - testFilePositionFromSourcePointer - "Test derivation of file position for sources or changes file from source pointers" - - | sf | - sf := ExpandedSourceFileArray new. - "sources file" - self assert: 0 = (sf filePositionFromSourcePointer: 16r1000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r1000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r1FFFFFF). - self assert: 16r1000000 = (sf filePositionFromSourcePointer: 16r3000000). - self assert: 16r1000013 = (sf filePositionFromSourcePointer: 16r3000013). - self assert: 16r1FFFFFF = (sf filePositionFromSourcePointer: 16r3FFFFFF). - "changes file" - self assert: 0 = (sf filePositionFromSourcePointer: 16r2000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r2000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r2FFFFFF). - self assert: 16r1000000 = (sf filePositionFromSourcePointer: 16r4000000). - self assert: 16r1000013 = (sf filePositionFromSourcePointer: 16r4000013). - self assert: 16r1FFFFFF = (sf filePositionFromSourcePointer: 16r4FFFFFF). - "the following numeric ranges are unused but currently produces results as follows" - self assert: 0 = (sf filePositionFromSourcePointer: 16r0000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r0000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r0FFFFFF) - ! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testAddressRange (in category 'testing') ----- - testAddressRange - "Test source pointer to file position address translation across a wide address range" - - | sf i p a | - sf := ExpandedSourceFileArray new. - (16r1000000 to: 16r10000000 by: 4093) do: [:e | - i := sf fileIndexFromSourcePointer: e. - p := sf filePositionFromSourcePointer: e. - a := sf sourcePointerFromFileIndex: i andPosition: p. - self assert: a = e] - ! Item was removed: - TestCase subclass: #StandardSourceFileArrayTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! - - !StandardSourceFileArrayTest commentStamp: 'dtl 12/13/2009 23:42' prior: 0! - This test documents the source pointer address conversion methods for StandardSourceFileArray. - - The available address space for source pointers in CompiledMethod is 16r1000000 through 16r4FFFFFF. StandardSourceFileArray maps positions in the sources file to address range 16r1000000 through 16r1FFFFFF and 16r3000000 through 16r3FFFFFF, and positions in the changes file to address range 16r2000000 through 16r2FFFFFF and 16r4000000 through 16r4FFFFFF. This permits a maximum file size of 16r2000000 (32MB) for both the sources file and the changes file. - ! Item was removed: - ----- Method: FileStreamTest>>testNextLine (in category 'as yet unclassified') ----- - testNextLine - | filename lines text | - filename := 'filestream.tst'. - lines := #('line 1' ' and line 2' '' 'fourth'). - text := lines first , String cr , lines second , String crlf , lines third , String lf , lines fourth. - - [ | file | - (StandardFileStream forceNewFileNamed: filename) - nextPutAll: text; - close. - - file := StandardFileStream readOnlyFileNamed: filename. - lines do: [:e | - self assert: file nextLine = e]. - self assert: file nextLine = nil. - file close] - ensure: [FileDirectory default deleteFileNamed: filename ifAbsent: [] ]! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testFileIndexFromSourcePointer (in category 'testing') ----- - testFileIndexFromSourcePointer - "Test derivation of file index for sources or changes file from source pointers" - - | sf | - sf := ExpandedSourceFileArray new. - "sources file mapping" - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1000000). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1000013). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r1FFFFFF). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3000000). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3000013). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r3FFFFFF). - - self assert: 1 = (sf fileIndexFromSourcePointer: 16r5000000). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r5000013). - self assert: 1 = (sf fileIndexFromSourcePointer: 16r5FFFFFF). - - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | self assert: 1 = (sf fileIndexFromSourcePointer: e)]. - (16r3000000 to: 16r3FFFFFF by: 811) do: [:e | self assert: 1 = (sf fileIndexFromSourcePointer: e)]. - "changes file mapping" - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2000000). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2000013). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r2FFFFFF). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4000000). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4000013). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r4FFFFFF). - - self assert: 2 = (sf fileIndexFromSourcePointer: 16r6000000). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r6000013). - self assert: 2 = (sf fileIndexFromSourcePointer: 16r6FFFFFF). - - (16r2000000 to: 16r2FFFFFF by: 811) do: [:e | self assert: 2 = (sf fileIndexFromSourcePointer: e)]. - (16r4000000 to: 16r4FFFFFF by: 811) do: [:e | self assert: 2 = (sf fileIndexFromSourcePointer: e)]. - - "the following numeric ranges are unused but currently produces results as follows" - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0000000). - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0000013). - self assert: 0 = (sf fileIndexFromSourcePointer: 16r0FFFFFF) - - ! Item was removed: - TestCase subclass: #ExpandedSourceFileArrayTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! - - !ExpandedSourceFileArrayTest commentStamp: 'dtl 12/22/2009 23:10' prior: 0! - This test documents the source pointer address conversion methods for ExpandedSourceFileArray. - - The available address space for source pointers in a traditional CompiledMethod is 16r1000000 through 16r4FFFFFF. StandardSourceFileArray maps positions in the sources file to address range 16r1000000 through 16r1FFFFFF and 16r3000000 through 16r3FFFFFF, and positions in the changes file to address range 16r2000000 through 16r2FFFFFF and 16r4000000 through 16r4FFFFFF. This permits a maximum file size of 16r2000000 (32MB) for both the sources file and the changes file. - - ExpandedSourceFileArray extends the source pointer address space using bit 25 of the source pointer to identify the external sources and changes files, with the remaining high order bits treated as address extension. This limits the number of external file references to two (the traditional sources and changes files). If additional external file references are needed in the future, some higher order bits in the source pointer address space should be allocated for that purpose. - - The use of bit 25 of the source pointer for file references permits backward compatibility with StandardSourceFileArray, with essentially unlimited address space expansion for the sources and changes files. - ! Item was removed: - ----- Method: FileDirectoryTest>>testAttemptExistenceCheckWhenFile (in category 'existence tests') ----- - testAttemptExistenceCheckWhenFile - "How should a FileDirectory instance respond with an existent file name?" - - | directory filename | - - filename := 'aTestFile'. - FileDirectory default forceNewFileNamed: filename. - directory := FileDirectory default directoryNamed: filename. - self shouldnt: [directory exists] description: 'Files are not directories.'. - - "clean up disk" - FileDirectory default deleteFileNamed: filename ifAbsent: [ ]! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryNonExistence (in category 'as yet unclassified') ----- - testFileDirectoryNonExistence - - | inexistentFileName | - - "Hoping that you have 'C:' of course..." - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - - inexistentFileName := DosFileDirectory default nextNameFor: 'DosFileDirectoryTest' extension: 'temp'. - - "This test can fail if another process creates a file with the same name as inexistentFileName - (the probability of that is very very remote)" - - self deny: (DosFileDirectory default fileOrDirectoryExists: inexistentFileName)! Item was removed: - ----- Method: MacFileDirectoryTest>>testMacFileDirectory (in category 'test') ----- - testMacFileDirectory - "(self run: #testMacFileDirectory)" - - "This fails before the the fix if the Squeak directory is on the root - directory like: 'HardDisk:Squeak' - But should work both before and after the fix of John if there is several - directories in the hieracry: HardDisk:User:Squeak" - "If somebody can find a way to make the test failed all the time when the fix is not - present we should replace it" - - self assert: (FileDirectory default fullName) = (FileDirectory default fullNameFor: (FileDirectory default fullName))! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryExists (in category 'as yet unclassified') ----- - testFileDirectoryExists - "Hoping that you have 'C:' of course..." - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - self assert: (FileDirectory root directoryExists: 'C:').! Item was removed: - ----- Method: FileDirectoryTest>>deleteDirectory (in category 'create/delete tests') ----- - deleteDirectory - - (self myDirectory exists) ifTrue: - [self myDirectory containingDirectory deleteDirectory: self myLocalDirectoryName]! Item was removed: - ----- Method: FileDirectoryTest>>myLocalDirectoryName (in category 'resources') ----- - myLocalDirectoryName - - ^'zTestDir'! Item was removed: - ----- Method: DosFileDirectoryTests>>testFullNameFor (in category 'as yet unclassified') ----- - testFullNameFor - "Hoping that you have 'C:' of course..." - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - self assert: (FileDirectory default fullNameFor: 'C:') = 'C:'. - self assert: (FileDirectory default fullNameFor: 'C:\test') = 'C:\test'. - self assert: (FileDirectory default fullNameFor: '\\share') = '\\share'. - self assert: (FileDirectory default fullNameFor: '\\share\test') = '\\share\test'. - self assert: (FileDirectory default fullNameFor: '\test') = (FileDirectory default pathParts first, '\test'). - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testIsDriveForShare (in category 'as yet unclassified') ----- - testIsDriveForShare - self assert: (DosFileDirectory isDrive: '\\server'). - self deny: (DosFileDirectory isDrive: '\\server\'). - self deny: (DosFileDirectory isDrive: '\\server\foo'). - ! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testChangesFileAddressRange (in category 'testing') ----- - testChangesFileAddressRange - "Test file position to source pointer address translation for the changes file" - - | sf i p a a2 | - sf := ExpandedSourceFileArray new. - (0 to: 16r1FFFFFFF by: 4093) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - i := sf fileIndexFromSourcePointer: a. - self assert: i == 2. - p := sf filePositionFromSourcePointer: a. - self assert: p = e. - a2 := sf sourcePointerFromFileIndex: 2 andPosition: p. - self assert: a2 = a]. - (0 to: 16rFFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r2000000 and: 16r2FFFFFF)]. - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r4000000 and: 16r4FFFFFF)]. - (16r2000000 to: 16r2FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r6000000 and: 16r6FFFFFF)]. - (16r3000000 to: 16r3FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r8000000 and: 16r8FFFFFF)]. - (16r4000000 to: 16r4FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16rA000000 and: 16rAFFFFFF)]. - (16r5000000 to: 16r5FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16rC000000 and: 16rCFFFFFF)]. - (16r6000000 to: 16r6FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16rE000000 and: 16rEFFFFFF)]. - (16r7000000 to: 16r7FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 2 andPosition: e. - self assert: (a between: 16r10000000 and: 16r10FFFFFF)] - - - - ! Item was removed: - ----- Method: ExpandedSourceFileArrayTest>>testCompatibilityWithStandardSourceFileArray (in category 'testing') ----- - testCompatibilityWithStandardSourceFileArray - "Test compatibility with StandardSourceFileArray across the address range of - StandardSourceFileArray, including the unused address space below 16r1000000" - - | ssf esf i1 i2 p1 p2 a1 a2 | - ssf := StandardSourceFileArray new. - esf := ExpandedSourceFileArray new. - (0 to: 16rFFFFFF by: 811) do: [:e | - i1 := ssf fileIndexFromSourcePointer: e. - i2 := esf fileIndexFromSourcePointer: e. - self assert: i1 = i2. - self assert: i1 = 0. "This is unused address space" - p1 := ssf filePositionFromSourcePointer: e. - p2 := esf filePositionFromSourcePointer: e. - self assert: p1 = p2]. - (16r4FFFFFF to: 16r4FFFFFF by: 811) do: [:e | - i1 := ssf fileIndexFromSourcePointer: e. - i2 := esf fileIndexFromSourcePointer: e. - self assert: i1 = i2. - p1 := ssf filePositionFromSourcePointer: e. - p2 := esf filePositionFromSourcePointer: e. - self assert: p1 = p2. - a1 := ssf sourcePointerFromFileIndex: i1 andPosition: p1. - a2 := esf sourcePointerFromFileIndex: i2 andPosition: p2. - self assert: a1 = a2. - self assert: a1= e] - - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryLocalName (in category 'as yet unclassified') ----- - testFileDirectoryLocalName - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory on: 'C:'. - self assert: fd localName = 'C:'. - ! Item was removed: - ----- Method: FileDirectoryTest>>testDirectoryNamed (in category 'existence tests') ----- - testDirectoryNamed - - self should: [(self myDirectory containingDirectory - directoryNamed: self myLocalDirectoryName) pathName - = self myDirectory pathName]! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryContainingEntry (in category 'as yet unclassified') ----- - testFileDirectoryContainingEntry - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory on: 'C:'. - self assert: (fd containingDirectory entryAt: fd localName) notNil. - ! Item was removed: - ClassTestCase subclass: #FileDirectoryTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! Item was removed: - TestCase subclass: #MacFileDirectoryTest - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Files-Tests'! Item was removed: - ----- Method: MacFileDirectoryTest>>testMacIsAbsolute (in category 'test') ----- - testMacIsAbsolute - "(self selector: #testMacIsAbsolute) run" - - - self deny: (MacFileDirectory isAbsolute: 'Volumes'). - self assert: (MacFileDirectory isAbsolute: 'Volumes:Data:Stef'). - self deny: (MacFileDirectory isAbsolute: ':Desktop:test.st')! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testSourcesFileAddressRange (in category 'testing') ----- - testSourcesFileAddressRange - "Test file position to source pointer address translation for the sources file" - - | sf a | - sf := StandardSourceFileArray new. - (0 to: 16r1FFFFFF by: 811) do: [:e | | a2 p i | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - i := sf fileIndexFromSourcePointer: a. - self assert: i == 1. - p := sf filePositionFromSourcePointer: a. - self assert: p = e. - a2 := sf sourcePointerFromFileIndex: 1 andPosition: p. - self assert: a2 = a]. - (0 to: 16rFFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r1000000 and: 16r1FFFFFF)]. - (16r1000000 to: 16r1FFFFFF by: 811) do: [:e | - a := sf sourcePointerFromFileIndex: 1 andPosition: e. - self assert: (a between: 16r3000000 and: 16r3FFFFFF)] - - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryContainingDirectoryExistence (in category 'as yet unclassified') ----- - testFileDirectoryContainingDirectoryExistence - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory on: 'C:'. - self assert: (fd containingDirectory fileOrDirectoryExists: 'C:').! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testSourcePointerFromFileIndexAndPosition (in category 'testing') ----- - testSourcePointerFromFileIndexAndPosition - "Test valid input ranges" - - | sf | - sf := StandardSourceFileArray new. - self should: [sf sourcePointerFromFileIndex: 0 andPosition: 0] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 1 andPosition: 0] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 2 andPosition: 0] raise: Error. - self should: [sf sourcePointerFromFileIndex: 0 andPosition: 3] raise: Error. - self should: [sf sourcePointerFromFileIndex: 1 andPosition: -1] raise: Error. - self shouldnt: [sf sourcePointerFromFileIndex: 1 andPosition: 16r1FFFFFF] raise: Error. - self should: [sf sourcePointerFromFileIndex: 1 andPosition: 16r2000000] raise: Error. - self should: [sf sourcePointerFromFileIndex: 3 andPosition: 0] raise: Error. - self should: [sf sourcePointerFromFileIndex: 4 andPosition: 0] raise: Error. - - self assert: 16r1000000 = (sf sourcePointerFromFileIndex: 1 andPosition: 0). - self assert: 16r1000013 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r13). - self assert: 16r1FFFFFF = (sf sourcePointerFromFileIndex: 1 andPosition: 16rFFFFFF). - self assert: 16r2000000 = (sf sourcePointerFromFileIndex: 2 andPosition: 0). - self assert: 16r2000013 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r13). - self assert: 16r2FFFFFF = (sf sourcePointerFromFileIndex: 2 andPosition: 16rFFFFFF). - self assert: 16r3000000 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1000000). - self assert: 16r3000013 = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1000013). - self assert: 16r3FFFFFF = (sf sourcePointerFromFileIndex: 1 andPosition: 16r1FFFFFF). - self assert: 16r4000000 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1000000). - self assert: 16r4000013 = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1000013). - self assert: 16r4FFFFFF = (sf sourcePointerFromFileIndex: 2 andPosition: 16r1FFFFFF) - ! Item was removed: - ----- Method: StandardSourceFileArrayTest>>testFilePositionFromSourcePointer (in category 'testing') ----- - testFilePositionFromSourcePointer - "Test derivation of file position for sources or changes file from source pointers" - - | sf | - sf := StandardSourceFileArray new. - "sources file" - self assert: 0 = (sf filePositionFromSourcePointer: 16r1000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r1000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r1FFFFFF). - self assert: 16r1000000 = (sf filePositionFromSourcePointer: 16r3000000). - self assert: 16r1000013 = (sf filePositionFromSourcePointer: 16r3000013). - self assert: 16r1FFFFFF = (sf filePositionFromSourcePointer: 16r3FFFFFF). - "changes file" - self assert: 0 = (sf filePositionFromSourcePointer: 16r2000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r2000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r2FFFFFF). - self assert: 16r1000000 = (sf filePositionFromSourcePointer: 16r4000000). - self assert: 16r1000013 = (sf filePositionFromSourcePointer: 16r4000013). - self assert: 16r1FFFFFF = (sf filePositionFromSourcePointer: 16r4FFFFFF). - "the following numeric ranges are unused but currently produces results as follows" - self assert: 0 = (sf filePositionFromSourcePointer: 16r0000000). - self assert: 16r13 = (sf filePositionFromSourcePointer: 16r0000013). - self assert: 16rFFFFFF = (sf filePositionFromSourcePointer: 16r0FFFFFF) - ! Item was removed: - ----- Method: FileDirectoryTest>>testDeleteDirectory (in category 'create/delete tests') ----- - testDeleteDirectory - "Test deletion of a directory" - - | aContainingDirectory preTestItems | - aContainingDirectory := self myDirectory containingDirectory. - preTestItems := aContainingDirectory fileAndDirectoryNames. - - self assert: self myAssuredDirectory exists. - aContainingDirectory deleteDirectory: self myLocalDirectoryName. - - self shouldnt: - [aContainingDirectory directoryNames - includes: self myLocalDirectoryName ] - description: 'Should successfully delete directory.'. - self should: - [preTestItems = aContainingDirectory fileAndDirectoryNames] - description: 'Should only delete the indicated directory.'. - - - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testIsDriveForDrive (in category 'as yet unclassified') ----- - testIsDriveForDrive - self assert: (DosFileDirectory isDrive: 'C:'). - self deny: (DosFileDirectory isDrive: 'C:\'). - self deny: (DosFileDirectory isDrive: 'C:\foo'). - self deny: (DosFileDirectory isDrive: 'C:foo').! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryEntryFor (in category 'as yet unclassified') ----- - testFileDirectoryEntryFor - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory root directoryEntryFor: 'C:'. - self assert: (fd name sameAs: 'C:').! Item was removed: - ----- Method: MacFileDirectoryTest>>testMakeAbsolute (in category 'test') ----- - testMakeAbsolute - - self assert: (MacFileDirectory isAbsolute: (MacFileDirectory makeAbsolute: 'Data')). - self assert: (MacFileDirectory isAbsolute: (MacFileDirectory makeAbsolute: ':Data')). - ! Item was removed: - ----- Method: FileDirectoryTest>>testOldFileOrNoneNamed (in category 'existence tests') ----- - testOldFileOrNoneNamed - - | file | - file := self myAssuredDirectory oldFileOrNoneNamed: 'test.txt'. - [self assert: file isNil. - - "Reproduction of Mantis #1049" - (self myAssuredDirectory fileNamed: 'test.txt') - nextPutAll: 'foo'; - close. - - file := self myAssuredDirectory oldFileOrNoneNamed: 'test.txt'. - self assert: file notNil] - ensure: [ - file ifNotNil: [file close]. - self myAssuredDirectory deleteFileNamed: 'test.txt' ifAbsent: nil] - - ! Item was removed: - ----- Method: DosFileDirectoryTests>>testFileDirectoryContainingDirectory (in category 'as yet unclassified') ----- - testFileDirectoryContainingDirectory - "Hoping that you have 'C:' of course..." - | fd | - FileDirectory activeDirectoryClass == DosFileDirectory ifFalse:[^self]. - fd := FileDirectory on: 'C:'. - self assert: fd containingDirectory pathName = ''. - ! Item was removed: - ----- Method: FileDirectoryTest>>testDirectoryExistsWhenLikeNamedFileExists (in category 'existence tests') ----- - testDirectoryExistsWhenLikeNamedFileExists - - [ | testFileName | - testFileName := self myAssuredDirectory fullNameFor: 'zDirExistsTest.testing'. - (FileStream newFileNamed: testFileName) close. - - self should: [FileStream isAFileNamed: testFileName]. - self shouldnt: [(FileDirectory on: testFileName) exists]] - ensure: [self myAssuredDirectory deleteFileNamed: 'zDirExistsTest.testing'] - - ! |
Free forum by Nabble | Edit this page |