Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Unscoped Capture Logger#3010

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Riyuzak2510 wants to merge3 commits intocatchorg:devel
base:devel
Choose a base branch
Loading
fromRiyuzak2510:UNSCOPED_CAPTURE_LOGGER

Conversation

@Riyuzak2510
Copy link

Adding Unscoped Capture Logger as a part of#2954

Description

Added Unscoped Capture Logger Feature as required to print details related to Capture

  • Added New Macro UNSCOPED_CAPTURE

GitHub Issues

Closes#2954

@Riyuzak2510Riyuzak2510force-pushed theUNSCOPED_CAPTURE_LOGGER branch fromb6d1042 tod34e490CompareJuly 30, 2025 06:10
@codecov
Copy link

codecovbot commentedJul 30, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.95%. Comparing base (3e82ef9) to head (5abeb26).

Additional details and impacted files
@@            Coverage Diff             @@##            devel    #3010      +/-   ##==========================================+ Coverage   90.92%   90.95%   +0.03%==========================================  Files         201      201                Lines        8653     8659       +6     ==========================================+ Hits         7867     7875       +8+ Misses        786      784       -2
🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Riyuzak2510Riyuzak2510force-pushed theUNSCOPED_CAPTURE_LOGGER branch 6 times, most recently from4e18ef2 to98c9b6fCompareAugust 6, 2025 16:18
Comment on lines 102 to 104
std::vector<MessageInfo>getMessageDetails()const {
return m_messages;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is not used anymore. For next time, this shouldn't be returning the vector by value, but by reference, and be ref-qualified if needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Removed it

Comment on lines 76 to 88
voidcaptureUnscopedValue(size_t index, std::stringconst& value );

template<typename T>
voidcaptureUnscopedValues(size_t index, Tconst& value ) {
captureUnscopedValue( index,Catch::Detail::stringify( value ) );
}

template<typename T,typename... Ts>
voidcaptureUnscopedValues(size_t index, Tconst& value, Tsconst&... values ) {
captureUnscopedValue( index,Catch::Detail::stringify(value) );
captureUnscopedValues( index+1, values... );
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's not duplicate these, and instead addbool isScoped parameter to the constructor ofCapturer, which will be kept to decide whethercaptureValue should create scoped or unscoped msg.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yeah modified this

getResultCapture().emplaceUnscopedMessage(Catch::MessageBuilder(
m_messages[index].macroName,
m_messages[index].lineInfo,
m_messages[index].type) << m_messages[index].message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No need to copy the value into message first and then write it into the msg builder stream.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done

#defineUNSCOPED_INFO( msg) (void)(0)
#defineWARN( msg) (void)(0)
#defineCAPTURE( ... ) (void)(0)
#defineUNSCOPED_CAPTURE( ... ) (void)(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please re-align the empty definitions for the whole block. (And same for the one around line 150)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done

@Riyuzak2510
Copy link
Author

@horenmar feel free to take a look

std::vector<MessageInfo> m_messages;
IResultCapture& m_resultCapture;
size_t m_captured =0;
bool isScoped;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Take a second look at how the other class variables are named.

m_resultCapture.pushScopedMessage( m_messages[index] );
m_captured++;
if(isScoped){
assert( index < m_messages.size() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The assert should live at the start of the function, both branches accessm_messages[index].

Comment on lines +120 to +122
if(index == m_messages.size() -1){
m_messages.clear();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No need to clear this here, instead check in destructor whetherm_isScoped is true and change it accordingly.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@horenmarhorenmarhorenmar left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

UNSCOPED_CAPTURE

2 participants

@Riyuzak2510@horenmar

[8]ページ先頭

©2009-2025 Movatter.jp