Menu

#118 bad stylesheet link in nunit2report

0.85
open
nobody
Tasks (69)
5
2006-10-31
2006-10-31
Paul
No

The link to the stylesheet in the pages for the
individual fixtures is wrong. It contains far too
many '../'. (For example on a class with 5 parts to
the fully qualified name (i.e. x.x.x.x.x) the link is

'../../../../../../../../../../../../../../../styleshe
et.css'

I think this is down to the logic in the
<xsl:template name="path"> template.

I think it should be like so

<xsl:template name="path">
<xsl:param name="path"/>
<xsl:choose>
<xsl:when test="contains($path,'.')">
<xsl:text>../</xsl:text>
<xsl:call-template name="path">
<xsl:with-param
name="path"><xsl:value-of select="substring-after
($path,'.')"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="not(contains($path,'.'))
and not($path = '')">
<xsl:text>../</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

The current implementation is

<xsl:template name="path">
<xsl:param name="path"/>
<xsl:if test="contains($path,'.')">
<xsl:text>../</xsl:text>
<xsl:call-template name="path">
<xsl:with-param
name="path"><xsl:value-of select="substring-after
($path,'.')"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(contains($path,'.')) and not
($path = '')">
<xsl:text>../</xsl:text>
</xsl:if>
</xsl:template>

for which the lower if condition will be entered
after the recursive call unecessarily, which results
in the extra '../' being added.

Discussion

  • Gert Driesen

    Gert Driesen - 2006-10-31

    Logged In: YES
    user_id=707851

    Please provide a small repro for this issue.

     
  • Paul

    Paul - 2006-11-01

    Logged In: YES
    user_id=1634579

    What do you mean by a repro? Do you want the project files and the NAnt code?

     
  • Gert Driesen

    Gert Driesen - 2006-11-01

    Logged In: YES
    user_id=707851

    The minimum set of files necessary to reproduce this issue.

    In this case:
    - a build file in which you compile the unit test assembly, run the unit tests, and format the results using
    <nunit2report>.
    - the sources for the unit test assembly.

     
  • Paul

    Paul - 2006-11-02

    Repro for this bug

     
  • Paul

    Paul - 2006-11-02

    Logged In: YES
    user_id=1634579

    To use repro:-

    1. Extract entire zip into a directory, preserving the directory structure.
    2. run NAnt from that directory (no need to specify any target).
    3. /Out/html will contain the NUnit2Report

    Have included the Out directory from when I was testing so you can see my results - the Out directory is deleted
    and re-created each time the NAnt script is run.

    FYI this is run on Windows Server 2003 SP1, with NUnit 2.2.8, NAnt 0.85, NAntContrib 0.85 and the VB.NET project is
    in VS2003 format.

     

Log in to post a comment.