← Back to PRs

#12087: Add comprehensive tests for markdown code-spans module

by YassineOUAHMANE open 2026-02-08 20:53 View on GitHub →
size: S
- Tests for createInlineCodeState initialization - Tests for buildCodeSpanIndex with various scenarios: - Basic inline code detection - Multiple code spans - Fence detection and edge cases - Multiple backtick counts - Unclosed code spans with state preservation - Edge cases (empty string, no backticks, consecutive spans, etc.) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds a new Vitest suite for `src/markdown/code-spans.ts`, covering `createInlineCodeState()` initialization and a variety of `buildCodeSpanIndex()` scenarios (single/multiple inline spans, differing backtick run lengths, fences, and unclosed spans with carry-over state). The tests exercise the module’s current `isInside()` semantics, which treat being inside a fenced block as well as inside an inline-code span as `true`. <h3>Confidence Score: 4/5</h3> - Safe to merge after clarifying a couple of misleading test expectations/comments. - Changes are test-only and align with current code-spans implementation, but some test names/comments misdescribe what indices represent and why fenced regions return true, which is likely to confuse maintenance and future refactors. - src/markdown/code-spans.test.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs