[BUG] FileDirectory>>exists

Anthony Adachi adachipro at yahoo.com
Tue May 20 20:49:58 UTC 2003


Lukas Renggli  wrote:
>  
>  > FileDirectoryTests>>testNonExistentDirectory
>  >
>  > [...]
>  >
>  > By the way, Lukas, can you confirm that the above
test
>  > passes on Mac OS X?
>  
>  Yes, the above test passes on Mac OS X.

Good! 

Now, we can go on to see if others knowledgeable about
the FileDirectory can clarify whether the
'FileDirectoryTests
>>testAttemptCreateInstanceWithFile' test makes the
correct assumptions:

*Should we expect a false result from 'directory
exists' when a FileDirectory instance has been created
with an existent file's name (in the containing
directory concerned) instead of a directory/folder
name? A true result would be misleading since while
there is an item with the same name in that location
it is not a directory/folder rather it is a file.

Actually, come to think of it the 'FileDirectoryTests
>>testAttemptCreateInstanceWithFile' method's name is
misleading in itself- I should of named it thusly: 

testAttemptExistenceCheckWhenFile
"How should a FileDirectory instance respond with an
existent file name?"
| directory |
FileDirectory default
				forceNewFileNamed: 'aTestFile'.
directory := FileDirectory default
				directoryNamed: 'aTestFile'.
self shouldnt: [directory exists]
	description: 'Files are not directories.'.

Lukas, is the assertion made by the above test case is
what you're expecting? If not please explain in a test
what you expect.

The one thing that test doesn't really make explicit
is:

*Should we be able to create a FileDirectory instance
even when a file exists of the same name in the
indicated location? Should an error be thrown or
should we be able to do so and it be up to the sender
to check for name conflicts.?

I'll leave it up to someone knowledgeable about this
class to submit a test case which illustrates the
expected behaviour on this last issue.

Thanks,

Anthony

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the Squeak-dev mailing list