ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Tulley" <JTUL...@novell.com>
Subject [PATCH] IntrospectionHelperTest needs a fix in OS dependent code
Date Thu, 11 Oct 2001 18:14:17 GMT
In IntrospectionHelperTest, the "setTen" method, there is a case where the code is expecting
two different things, depending on whether it was on a "UNIXStyle" system or not.  I just
added a third case of a NetWare style of system.

To me this seems weird that the test is even bothering checking something that is simply an
OS-dependent thing, namely how an File.getAbsolutePath() returned path should look:

    public void setTen(File f) {
        if (isUnixStyle) { 
            assertEquals("/tmp/2", f.getAbsolutePath());
        } else if (System.getProperty("os.name").toLowerCase().equals("netware")) {
            assertEquals("\\tmp\\2", f.getAbsolutePath().toLowerCase());
        } else {
            assertEquals(":\\tmp\\2", f.getAbsolutePath().toLowerCase().substring(1));
        }
    }

This seems to be simply testing the JVM, not Ant.  Am I mistaken in this?  (At very least,
I'm guilty of having written test code like this before, so I cannot say much, but I'm trying
to learn from my mistakes).

For reference, here is the JavaDoc of File.getAbsolutePath() (from JDK 1.1 docs)

public String getAbsolutePath()

     Returns the absolute pathname of the file represented by this object. If this object
represents an absolute pathname, then return the pathname. Otherwise, return a pathname that
is a concatenation of the current user directory, the separator character, and the pathname
of this file object. 

     The system property user.dir contains the current user directory. 

     Returns: 
          a system-dependent absolute pathname for this File. 

     See Also: 
          getPath, isAbsolute, getProperty 



Jeff Tulley  (jtulley@novell.com)
(801)861-5322
Novell, Inc., the leading provider of Net services software.


Mime
View raw message