Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Testing logger functions

Open jagmohan-nanaware opened this issue 3 years ago • 2 comments

I am building a logger library. I am facing two issues here:

  1. the log functions by default print a log string in the terminal. so the function prototype for log is something like this void log_trace(int, char*, char*, char*); This function, internally concatenates the inputs and constructs a string and prints it on the screen. How do I use REQUIRE or REQUIRE_THAT to compare this ourput with a expected output string? (THe string that is displayed on the screen is not constructed as whole string.)
  2. The log string generated includes internally generated strings concatenated with user supplied string.

jagmohan-nanaware avatar Mar 29 '21 19:03 jagmohan-nanaware

I would like to contribute to solve this issue. So if possible, can you please assign this issue to me and help me with some resources for the issue? @jagmohan-nanaware @philsquared @CatchBot @martinmoene @horenmar @socantre @godlygeek @jbytheway @rpavlik @hanneskaeufler @drewish @andybalaam @mikezackles @berkus @mloskot @nanoant @aivarsk @johnelse @Minoru @vadz @JLospinoso @tomhughes @razeh @snewell @Fraser999 @ahans @wichert @benagain @jweyrich @girtsf

sharmadhiraj86 avatar Sep 10 '22 14:09 sharmadhiraj86

Please don't tag that many folks, it's pretty rude, like spamming. If you want an interactive response, try the Discord channel. Regarding the actual issue, the usual way folks test things like this is by being able to replace the internal target of logging, etc with some kind of mock or alternate stream that can be inspected easier. I'm not sure there's a (portable) way to inspect what's already been output to a console.

rpavlik avatar Sep 12 '22 12:09 rpavlik