microsoft / microsoft/qdk

Use debug printing for expect_test in the parser and other places.

Open
#1,321 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
1k
Forks
212
Avg merge
3d 8h
Merged PRs (30d)
65

Description

We currently use `ToString::to_string` (i.e., `Display`) in our expect test tests for the parser ([see here](https://github.com/microsoft/qsharp/blob/main/compiler/qsc_parse/src/tests.rs#L11)). This is problematic, because this trait is typically used for user-facing representations of data structures. We are forced to choose between a pretty user-facing representation, and a more technically accurate debug-style representation for testing for namespace names in #1312 as a result.

Contributor guide

Open the contributing guide

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.

Research direction

Start with compiler/qsc_parse/src/tests.rs around line 11 and inspect how parser expect tests currently produce their values. Search for other expect tests using ToString::to_string, then determine the affected test outputs and update them to use the technically accurate debug representation. Done means the relevant expect tests consistently capture debug-style values without changing user-facing formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.