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

[wpilib] Add epoch print tests to Tracer #2473

Open
calcmogul opened this issue Apr 6, 2020 · 5 comments
Open

[wpilib] Add epoch print tests to Tracer #2473

calcmogul opened this issue Apr 6, 2020 · 5 comments
Labels
component: wpilibc WPILib C++ component: wpilibj WPILib Java type: testing Related to testing.

Comments

@calcmogul
Copy link
Member

Verifying the contents of epoch prints would have caught #2392.

Here's an example of verifying stdout contents with Google Test: https://github.com/wpilibsuite/allwpilib/blob/master/wpiutil/src/test/native/cpp/UnitsTest.cpp#L1307-L1310

Here's an example of verifying stdout contents with JUnit: https://stackoverflow.com/a/1119559/5484466

@Starlight220
Copy link
Member

I can do Java, how do I get output from DS.reportWarning()?

@calcmogul
Copy link
Member Author

In unit tests, ReportWarning() just prints to stderr, so you just need to capture console output.

@Starlight220
Copy link
Member

In Java, there is an overload that takes a lambda - can be used for testing. Dunno if C++ has this option as well.

@Starlight220
Copy link
Member

Starlight220 commented Sep 14, 2020

Would it be good enough to make sure that the output conforms to a certain regex, or is something more thorough required?

@AustinShalit
Copy link
Member

For Java, you might take a look to see if SystemRules was updated for JUnit 5: stefanbirkner/system-rules#55

@calcmogul calcmogul added the type: testing Related to testing. label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wpilibc WPILib C++ component: wpilibj WPILib Java type: testing Related to testing.
Projects
None yet
Development

No branches or pull requests

3 participants