Skip to content

refactor: Suppress printing to stdout in test cases by logging to a reporter#533

Merged
Vighnesh-V merged 1 commit intoprimaryfrom
lute-reporter
Nov 10, 2025
Merged

refactor: Suppress printing to stdout in test cases by logging to a reporter#533
Vighnesh-V merged 1 commit intoprimaryfrom
lute-reporter

Conversation

@Vighnesh-V
Copy link
Copy Markdown
Collaborator

This PR adds a reporter to the Lute.CLI.Lib library. Right now, our tests just log directly to stderr / stdout and we don't have any control over this or ability to intercept and test these calls. I've introduced LuteReporter which has TestReporter and CliReporter as subclasses, which store reported strings / logs to stderr/stdout respectively.

This lets us access the errors logged out in tests as well as suppresses random logging in our tests.

Fixes: #511

@vrn-sn
Copy link
Copy Markdown
Member

vrn-sn commented Nov 6, 2025

I think there's some compile errors right now, could you check those out?

@Vighnesh-V
Copy link
Copy Markdown
Collaborator Author

I think ubuntu runners are a little more picky about includes - this passed on macos locally. I was missing a include.

@Vighnesh-V Vighnesh-V force-pushed the lute-reporter branch 2 times, most recently from c4a0989 to 3908c00 Compare November 6, 2025 19:59
Comment thread lute/cli/include/lute/reporter.h
Comment thread lute/cli/include/lute/staticrequires.h Outdated
Comment thread lute/cli/include/lute/tc.h Outdated
Comment thread tests/src/stdsystem.test.cpp Outdated
Comment thread tests/src/require.test.cpp Outdated
Comment thread lute/cli/src/climain.cpp Outdated
Comment thread lute/cli/include/lute/reporter.h Outdated
Comment thread lute/cli/include/lute/reporter.h Outdated
@vrn-sn
Copy link
Copy Markdown
Member

vrn-sn commented Nov 7, 2025

Also, don't we need to make CMakeLists.txt changes? (How is this compiling...)

Edit: it's compiling because the new files are being included into existing source files, but we should split stuff into .h/.cpp files and add everything to CMakeLists.txt.

Comment thread tests/src/cliruntimefixture.cpp Outdated
Comment thread tests/src/cliruntimefixture.cpp Outdated
Comment thread tests/src/compile.test.cpp Outdated
Comment thread tests/src/require.test.cpp Outdated
Comment thread tests/src/staticrequires.test.cpp Outdated
Comment thread tests/src/stdsystem.test.cpp Outdated
Comment thread lute/cli/CMakeLists.txt Outdated
Comment thread tests/src/stdsystem.test.cpp Outdated
…eporter

more changes

one more round of feedback
Copy link
Copy Markdown
Member

@vrn-sn vrn-sn left a comment

Choose a reason for hiding this comment

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

Might be worth running clang-format one more time just to be safe since I merged in some new clang-format rules earlier today.

@Vighnesh-V Vighnesh-V merged commit 699b909 into primary Nov 10, 2025
11 checks passed
@Vighnesh-V Vighnesh-V deleted the lute-reporter branch November 10, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test output being polluted with prints intended for CLI

2 participants