Skip to content

Conversation

@gurry
Copy link
Contributor

@gurry gurry commented Jul 29, 2025

This PR improves cargo-wdk tests by:

  • Reducing code duplication
  • Shortening tests names to make them easier to understand

I wanted to do this for crates/cargo-wdk/src/actions/build/tests.rs as well but those tests are more complex and therefore require more thinking. Will open a different PR for them.

@gurry gurry requested a review from Copilot July 29, 2025 04:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors cargo-wdk tests to improve code maintainability by consolidating duplicate logic and using more descriptive test names. The changes span three test files, replacing verbose test names with concise ones and extracting common functionality into reusable helper functions.

Key changes:

  • Simplified test names from verbose descriptions to concise action-based names
  • Created helper functions to eliminate code duplication across test scenarios
  • Consolidated file verification logic into reusable utility functions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
crates/cargo-wdk/tests/new_command_test.rs Shortened test names and extracted command invocation logic into helper functions
crates/cargo-wdk/tests/build_command_test.rs Refactored repetitive file verification code into helper functions and simplified test structure
crates/cargo-wdk/src/cli.rs Consolidated duplicate test logic for architecture detection into parameterized helper functions

@gurry gurry force-pushed the improve-tests branch 2 times, most recently from 3e70ec1 to 23d97d4 Compare July 29, 2025 06:30
by reducing code duplication and shortening test names
@gurry gurry requested review from a team and krishnakumar4a4 July 29, 2025 07:40
@gurry gurry enabled auto-merge July 29, 2025 07:40
Copy link
Contributor

@krishnakumar4a4 krishnakumar4a4 left a comment

Choose a reason for hiding this comment

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

LGTM

@gurry gurry requested a review from a team July 30, 2025 10:32
@gurry gurry added this pull request to the merge queue Jul 31, 2025
Merged via the queue into microsoft:main with commit 34bbc1f Jul 31, 2025
63 checks passed
@gurry gurry deleted the improve-tests branch July 31, 2025 05:25
@leon-xd leon-xd mentioned this pull request Oct 17, 2025
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.

3 participants