Re: Path-related asserts

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <001301c8701a$e9408740$6401a8c0@ferrari>
Hi Daniel,

> I was thinking about this a little bit, and I came up with a 
> suggestion:
> 
> Any assert that is based on tests, allow a parameter to them 
> "bool ignoreCase" which is passed into the String.Compare().  
> Users of these asserts can do what they feel is best.  For 
> instance, you could do your test of Path.DirectorySeperator, 
> and I could always tell it to ignore case.

Actually, we already have an IgnoreCase property on Constraint,
which is used by the string and equality constraints. The default
is to do a exact case-dependent compare. This could easily be
used by a path constraint in the same way.

> You can also include overloads of those asserts which omit 
> that parameter, just like String.Compare does.  If the 
> parameter is omitted either always ignore case, or never omit 
> case.  Do not base it on the OS, since as discussed it is not 
> OS dependant.  I am in favour of always ignoring case, but I 
> could see either way.  Whichever, this will provide some 
> consistancy.  Whatdya say?

I like reusing stuff. :-)

Charlie
 
> dmp
> 
> Charlie Poole wrote:
> > Hi Kelly,
> >
> >   
> >>> Hmmm... So given a path, without any knowledge of a 
> particular file 
> >>> system for which it is intended, we can't tell whether it's case 
> >>> sensitive or not. In practice, we probably always know the
> >>>       
> >> file system
> >>     
> >>> for which it is intended, but the devil is in the details.
> >>>       
> >> Is there a centralized place like an XML file or an INI 
> file or gasp 
> >> Registry where such preferences could be kept? This is a general 
> >> question more than a specific suggestion in this case...
> >>     
> >
> > Sure, the NUnit settings file is available. However, a central 
> > location is only useful for things that have a single value all the 
> > time. Since you can have multiple file systems on a 
> machine, there's 
> > no way to specify as a setting which one you are talking about.
> >
> > For files that actually exist on the system in question, the path 
> > tells you what system it is part of. So this problem is fairly 
> > restricted: it only comes up if you need to test the 
> content of paths 
> > for other systems than the one you are running on.
> >
> > Charlie
> >  
> >   
> >> -Kelly
> >>
> >> --------------------------------------------------------------
> >> -----------
> >> This SF.net email is sponsored by: Microsoft Defy all challenges. 
> >> Microsoft(R) Visual Studio 2008.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >> _______________________________________________
> >> nunit-developer mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> >>
> >>     
> >
> >
> >
> > 
> ----------------------------------------------------------------------
> > --- This SF.net email is sponsored by: Microsoft Defy all 
> challenges. 
> > Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > nunit-developer mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/nunit-developer
> >
> >
> >   
> 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.