FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Testing & Debugging Blog: You Are Not Done Yet: Filename Invalid Characters and Error Cases
Testing and Debugging
BREAKPOINTS

Test, Debug, Release, Rinse, Repeat ...

by Kevin Carlson
THE BOOK OF TESTING

Thoughts From a Braidy Tester

by Michael Hunter
April 17, 2006

You Are Not Done Yet: Filename Invalid Characters and Error Cases

You are not done testing yet unless...

You have checked for invalid characters in filenames, and for reserved filenames. Operating systems tend to get grumpy if you try to use wildcards (e.g., '*') in filenames. They may also treat certain filenames specially. For example, Microsoft Windows provides a single API for creating/opening files, communication ports, and various other cross-process communication mechanisms. Well-known communication ports (e.g., COM1) are addressed by "filename" just as though they were a file - kinda handy, but it means that you can't use "COM1" for a physical file on disk.

Testing for this is easy: brainstorm a list of interesting test cases, then slap each one into each of your application's dialog boxes, command line arguments, and APIs that take a filename. Illegal characters will probably throw an error, but trying to open a reserved filename is likely to hang your app.

See the MSDN topic "Naming a file" for the full skinny on reserved characters and filenames on Microsoft operating systems.

Posted by The Braidy Tester at 09:30 AM  Permalink




 
INFO-LINK