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

lscpu: Add option --json #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

howjmay
Copy link
Contributor

@howjmay howjmay commented Jul 24, 2024

closes #15

src/uu/lscpu/Cargo.toml Outdated Show resolved Hide resolved
@howjmay howjmay force-pushed the lscpu-json branch 3 times, most recently from 6f167ca to 06097ab Compare July 24, 2024 20:58
@sylvestre
Copy link
Contributor

please add tests to make sure we don't regress
thanks

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 82.35294% with 6 lines in your changes missing coverage. Please review.

Project coverage is 49.29%. Comparing base (cc93968) to head (fc7bf39).
Report is 36 commits behind head on main.

Files Patch % Lines
src/uu/lscpu/src/lscpu.rs 78.57% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   42.44%   49.29%   +6.85%     
==========================================
  Files          13       14       +1     
  Lines        1555     1641      +86     
  Branches      209      217       +8     
==========================================
+ Hits          660      809     +149     
+ Misses        868      793      -75     
- Partials       27       39      +12     
Flag Coverage Δ
macos_latest 49.48% <82.35%> (+7.04%) ⬆️
ubuntu_latest 45.24% <82.35%> (+6.91%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@howjmay howjmay force-pushed the lscpu-json branch 2 times, most recently from 12928c3 to 7300355 Compare July 25, 2024 06:47
@howjmay
Copy link
Contributor Author

howjmay commented Jul 25, 2024

@sylvestre test added

@howjmay howjmay force-pushed the lscpu-json branch 2 times, most recently from 31eac3d to b897808 Compare July 25, 2024 06:50
@howjmay
Copy link
Contributor Author

howjmay commented Jul 28, 2024

@sylvestre Anything I should improve to this PR?

Copy link
Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

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

sorry, forgot to press submit


#[test]
#[ignore]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}

#[test]
fn test_json() {
Copy link
Contributor

Choose a reason for hiding this comment

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

please verify a bit more the format
at least some of these:

{
   "lscpu": [
      {
         "field": "Architecture :",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

i don't see what has been changed ? sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah sorry I fixed the implementation only. I have no idea how to test the format here. The result varies on different platform. Not sure how can I implement a uniform interface for testing it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @sylvestre any suggestions?

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.

lscpu: Add option --json
2 participants