[Routine - MIGAO] Add unit test coverage for PinyinDict TSV parsing - #38
Draft
winterdrive wants to merge 1 commit into
Draft
[Routine - MIGAO] Add unit test coverage for PinyinDict TSV parsing#38winterdrive wants to merge 1 commit into
winterdrive wants to merge 1 commit into
Conversation
Extracts the inline parsing loop in PinyinDict::load() into a standalone parse_tsv_into() function (mirroring the existing pattern in dict.rs) and covers it with tests for blank/comment lines, malformed rows, unparseable frequency fallback, and multi-entry accumulation. pinyin_dict.rs previously had zero test coverage.
This was referenced Aug 21, 2026
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.
Pre-flight Check
src/bin/watch.rsonly.routine/migao-fix-tray-truncate-test-coverage-260819(= PR [Routine - MIGAO] Add unit test coverage for tray tooltip truncate() helper #37,src/bin/watch.rs),routine/migao-fix-rule-apply-top-n-coverage-260818(already merged as PR [Routine - MIGAO] Add unit test coverage for Rule trait default apply_top_n #27, touchedsrc/rule.rs).src/pinyin_dict.rs, which is untouched by PR [Routine - MIGAO] Add unit test coverage for tray tooltip truncate() helper #37 and by any active branch — no overlap.Changes
src/pinyin_dict.rshad zero test coverage. Extracted the inline TSV-parsing loop inPinyinDict::load()into a standaloneparse_tsv_into()function (mirroring the existing pattern already used insrc/dict.rs), and added unit tests covering:#comment lines are skipped1global()loads a non-empty dict from the embeddeddata/pinyin.tsvThis PR does not modify core dictionary data (
data/bopomofo.tsvor any embedded RIME resources), does not add/remove/update anyCargo.tomldependencies, and does not touch package version metadata.Safety Verification
Run locally on this branch, all passed:
cargo check --all-targets— passedcargo clippy --all-targets -- -D warnings— passed, no warningscargo test— 101 passed (up from 96), 0 failed, in themigaolib test binary;migao-watchbin tests (6) and doc-tests unaffectedcargo fmt --check— passed, no diffCI / Release Gate Note
This is a daily routine Draft PR. Package version bump (
Cargo.toml/Cargo.lock) andCHANGELOG.mdconsolidation are intentionally deferred to the weekend release/integration PR.