-
Notifications
You must be signed in to change notification settings - Fork 16
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
w: Format time and get cmdline #41
w: Format time and get cmdline #41
Conversation
This change allows w to display time in a similar way to the original procps w. Additionally, w now fetches the cmdline for each entry.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #41 +/- ##
==========================================
+ Coverage 45.53% 45.82% +0.28%
==========================================
Files 15 15
Lines 1803 1831 +28
Branches 240 247 +7
==========================================
+ Hits 821 839 +18
- Misses 853 859 +6
- Partials 129 133 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
nice, could you please add a test? thanks |
No problem, I've added a unit test for each new function. I did this instead of testing the actual output, because it is bound to change in the future and the unit tests may be helpful if/when these functions are moved into a different location. |
Sure and thanks but could you please add integration test in tests/ too? Thanks |
It makes more since to make fetch_cmdline and format_time public functions until they are moved into a library or seperate file and just use integration tests from the start.
I went ahead and removed the unit tests and added integration tests into tests/ instead. It might be a good idea to treat them as public functions from the start and then move them into a library or separate file, when it is time. |
Please keep the function tests in the same file. |
Unit tests are where they should be and there is an added test that checks the output of w.
I've put the unit tests where they should be and I've added an integration test in tests/ that checks the current output of w. |
The time library has been switched to chrono. Also, the integration test for cmdline checking has been dropped, as there is really no expectation of what it should be.
912fe92
to
50e9da9
Compare
* w: Format time and get cmdline This change allows w to display time in a similar way to the original procps w. Additionally, w now fetches the cmdline for each entry.
* w: Format time and get cmdline This change allows w to display time in a similar way to the original procps w. Additionally, w now fetches the cmdline for each entry.
This change allows w to display time in a similar way to the original procps w. Additionally, w now fetches the cmdline for each entry.
Later, the fetch_cmdline and possibly format_time functions could be seperated out into a shared library for future applications, such as
ps
ortop
.