microsoft / microsoft/rs-deviceid

wish: Windows test where DevDeviceId::get() returns Ok(None)

Open
#8 0 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4
Forks
2
Avg merge
12h 8m
Merged PRs (30d)
1

Description

I want a test that shows that DevDeviceId::get() on Windows returns Ok(None) if there's no device id in the registry. Of course on any regular dev machine that won't be the case if you have run the test before, or if you have various Microsoft developer tools installed.

On Unix we could fake it by setting HOME to an empty temporary directory during the test.

On Windows we can't really fake an empty registry.

One approach is to use a mock: instead of using the functions from the winreg crate directly, we make a WindowsRegistry trait and two implementation structs. One that just calls the winreg functions and a MockRegistry struct that either returns canned responses or uses an in-memory database, and run the tests against a fake registry.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.