Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding source file and linenumber in Warn and Info xml tags #1251

Closed
vvvlc opened this issue Apr 15, 2018 · 0 comments
Closed

Adding source file and linenumber in Warn and Info xml tags #1251

vvvlc opened this issue Apr 15, 2018 · 0 comments

Comments

@vvvlc
Copy link

vvvlc commented Apr 15, 2018

Description

Hi
I would like to have file name and line number attributes in Warn and Info tags of xml reporter, so I can easily identify find them in source code. Moreover this would be more consistent with Failure or Expression that already exposes such information.

Steps to reproduce

TEST_CASE("simple test"){
	INFO("tmp start----------------");
	WARN("go  end----------------");
}

Generates

      <Warning>
        go  end----------------
      </Warning>
      <Info>
        tmp start----------------
      </Info>

I would like to add additional attributes like filename and line.

      <Warning filename="../src/tests.cc" line="62">
        go  end----------------
      </Warning>
      <Info filename="../src/tests.cc" line="58">
        tmp start----------------
      </Info>

Extra information

Here proposal for improvement of bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ), adding writeSourceInfo( msg.lineInfo )

            for( auto const& msg : assertionStats.infoMessages ) {
                if( msg.type == ResultWas::Info && includeResults ) {
                    auto tag = m_xml.scopedElement( "Info" );
                    writeSourceInfo( msg.lineInfo );
                    tag.writeText( msg.message );
                } else if ( msg.type == ResultWas::Warning ) {
                    auto tag = m_xml.scopedElement( "Warning" );
                    writeSourceInfo( msg.lineInfo );
                    tag.writeText( msg.message );
                }

Thx
Vitek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants