Skip to content

type-c-service/tests: Convert example/service to test#890

Draft
RobertZ2011 wants to merge 2 commits into
OpenDevicePartnership:stable-v0.1.yfrom
RobertZ2011:type-c-back-port-service
Draft

type-c-service/tests: Convert example/service to test#890
RobertZ2011 wants to merge 2 commits into
OpenDevicePartnership:stable-v0.1.yfrom
RobertZ2011:type-c-back-port-service

Conversation

@RobertZ2011

Copy link
Copy Markdown
Contributor

No description provided.

@RobertZ2011 RobertZ2011 self-assigned this Jun 11, 2026
@RobertZ2011 RobertZ2011 requested a review from Copilot June 11, 2026 17:56
@RobertZ2011 RobertZ2011 changed the title Type c back port service type-c-service/tests: Convert example/service to test Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 add PartialEq/Eq derives 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 thread type-c-service/Cargo.toml
Comment on lines 56 to 63
log = [
"dep:log",
"embedded-services/log",
"embassy-time/log",
"embassy-sync/log",
"tps6699x/log",
"power-policy-service/log",
]
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.

2 participants