Skip to content

Conversation

@dereuromark
Copy link
Contributor

Summary

Fixes the compatibility report's test file parser to correctly parse official djot test files that use 4-backtick fences.

The Problem

The compatibility report was showing 2 failing tests (99% compatibility), but investigation revealed the actual djot parser handles these cases correctly. The issue was in how tests/compatibility-report.php parses the official test files.

Many djot tests use 4-backtick fences (``````) to wrap test cases that contain 3-backtick code blocks (```). The parser's regex only matched 3-backtick fences, causing it to incorrectly parse nested content.

The Fix

Updated the regex to match both fence lengths:

// Before: only matched 3 backticks
preg_match_all('/```\n(.*?)\n```/s', ...)

// After: matches both, longer first for proper nesting
preg_match_all('/````\n(.*?)\n````|```\n(.*?)\n```/s', ...)

Result

  • Before: 236/238 tests (99% compatibility) - false failures
  • After: 245/245 tests (100% compatibility)

The increase in test count (238 → 245) is because tests wrapped in 4-backtick fences are now correctly parsed, and some test files had additional tests that were previously missed.

The test file parser was only matching 3-backtick fences, but many
official djot tests use 4-backtick fences to wrap tests that contain
3-backtick code blocks.

Updated regex to match both fence lengths, prioritizing longer fences
first to properly handle nested content.

Result: 245/245 tests passing (100% compatibility)
Previously: 236/238 due to incorrect parsing of nested fenced tests
@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.68%. Comparing base (5085c8e) to head (8806673).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #52      +/-   ##
============================================
+ Coverage     93.64%   93.68%   +0.04%     
- Complexity     1916     1928      +12     
============================================
  Files            74       74              
  Lines          5143     5177      +34     
============================================
+ Hits           4816     4850      +34     
  Misses          327      327              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dereuromark dereuromark merged commit 3543a18 into master Dec 14, 2025
6 checks passed
@dereuromark dereuromark deleted the fix/spec-edge-cases branch December 14, 2025 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants