test: same-line [[target]] [[target]] の trim test を追加 (#241)#244
Merged
Conversation
`iterateWikilinkOccurrences` (search.ts:367-380) は yield 毎に新規 ref オブ ジェクトを alloc する設計で、PR #235 で producer-side に置いた `line.trim()` はその「per-yield 新規 alloc」前提に依存している。将来 helper が ref を pool / reuse する refactor を入れると trim 効果が壊れる可能性があるため、同一行に `[[target]]` が複数回出る case を defensive な test として lock する。 - `scanBacklinksImpl` describe: 既存 #227 trim test (line 432-443) の隣に追加。 `src.md` に `" see [[target]] and [[target]] in the same line \n"` を書き、 両 ref の `lineContent` が同一 trim 済 string であること、`byteOffset` は別 であることを assert。 - `scanUnresolvedWikilinksImpl` describe: 対称に追加。issue では optional 扱い だが、既存 #227 trim test が両 consumer にペアで存在する pattern と整合させ るため両側追加する判断。 production code は無変更 (test 追加のみ、+38 / -0)。
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.
概要
iterateWikilinkOccurrences(electron/main/ipc/search.ts:367-380) は yield 毎に新規 ref オブジェクトを alloc する設計で、PR #235 で producer-side に置いたline.trim()はその「per-yield 新規 alloc」前提に依存している。将来 helper が ref を pool / reuse する refactor を入れると trim 効果が壊れる可能性があるため、同一行に[[target]]が複数回出る case を defensive な test として lock する。production code は無変更 (test 追加のみ、+38 / -0)。
関連 Issue
Closes #241
移行 Stage
post-migration の保守 (該当 Stage なし)
変更内容
scanBacklinksImpldescribe に同一行 trim test を追加 (electron/main/ipc/search.test.ts:464) — 既存 refactor: BacklinkPanel lineContent.trim() の allocation 削減と描画 policy 統一 #227 trim test の隣に配置。src.mdに" see [[target]] and [[target]] in the same line \n"を書き、両 ref のlineContentが同一の trim 済 string であること +byteOffsetは別 (= 独立 alloc された別 ref であること) を assertscanUnresolvedWikilinksImpldescribe に対称 test を追加 (electron/main/ipc/search.test.ts:195) — issue では optional 扱いだが、既存 refactor: BacklinkPanel lineContent.trim() の allocation 削減と描画 policy 統一 #227 trim test が両 consumer (backlinks / unresolved) にペアで存在する pattern と整合させるため両側追加する判断issue snippet からの逸脱
なし。issue 本文の snippet をほぼそのまま採用 (formatter による expect の行折り返し差のみ)。
動作確認
node_modules/.bin/tsc --noEmit— pass (typecheck clean)node_modules/.bin/biome check electron/main/ipc/search.test.ts— passnode_modules/.bin/vitest run electron/main/ipc/search.test.ts— 93/93 pass (新規 2 件含む)node_modules/.bin/vitest run(full suite) — 2230 passed / 2 skipped / 0 failed (HANDOFF 41 の 2228 + 新規 2 = 想定通り)/code-review medium— 8 angle (3 correctness + 3 cleanup + altitude + conventions) review、findings 0 件