type-c-service/tests: Convert example/service to test#890
Draft
RobertZ2011 wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR moves the previously std example for the Type-C service into an integration test, so the behavior is exercised under cargo test rather than via a standalone example binary.
Changes:
- Add a Tokio-based integration test (
type-c-service/tests/service.rs) that simulates debug accessory connect/disconnect and asserts emitted comms messages. - Refactor test support code to export controller/port IDs for reuse from multiple tests (
type-c-service/tests/common/mod.rs). - Remove the std example binary (
type-c-service), and addPartialEq/Eqderives to Type-C comms message types to support equality assertions in tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| type-c-service/tests/service.rs | New integration test validating debug accessory connect/disconnect message emission. |
| type-c-service/tests/common/mod.rs | Exposes IDs/constants needed by multiple test modules. |
| type-c-service/Cargo.toml | Adjusts log feature list (but currently mixes in a dev-only dependency feature). |
| examples/std/src/bin/type_c/service.rs | Removes the old std example implementation. |
| examples/std/Cargo.toml | Removes the type-c-service bin target registration. |
| embedded-service/src/type_c/comms.rs | Adds PartialEq/Eq derives so tests can assert_eq! on comms messages. |
Comment on lines
56
to
63
| log = [ | ||
| "dep:log", | ||
| "embedded-services/log", | ||
| "embassy-time/log", | ||
| "embassy-sync/log", | ||
| "tps6699x/log", | ||
| "power-policy-service/log", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.