Skip to content

Latest commit

 

History

History
78 lines (58 loc) · 1.83 KB

File metadata and controls

78 lines (58 loc) · 1.83 KB

Test Suite

Integration tests for codediff.nvim using plenary.nvim.

Test Coverage

✅ FFI Integration (ffi_integration_spec.lua)

C ↔ Lua boundary validation:

  • Data structure conversion
  • Memory management (no leaks)
  • Edge cases (empty diffs, large files)

10 tests

✅ Git Integration (git_integration_spec.lua)

Git operations and async handling:

  • Repository detection
  • Async callbacks
  • Error handling for invalid revisions
  • Path calculation
  • LRU cache validation

9 tests

✅ Installer (installer_spec.lua)

Automatic binary installation and version management:

  • Module API validation
  • VERSION loading from version.lua
  • Library path construction
  • Version detection from filenames
  • Update necessity logic
  • Platform-specific extension handling

10 tests

✅ Auto-scroll (autoscroll_spec.lua)

Diff view scrolling behavior:

  • Scroll to first change
  • Window centering
  • Scroll sync activation

5 tests

✅ Semantic Tokens (render/semantic_tokens_spec.lua)

LSP integration and rendering:

  • Module compatibility checks
  • Virtual file URL handling
  • Namespace management

12 tests

Running Tests

All tests:

./tests/run_plenary_tests.sh

Individual spec:

nvim --headless --noplugin -u tests/init.lua \
  -c "lua require('plenary.test_harness').test_directory('tests/ffi_integration_spec.lua')"

Test Philosophy

Focus on integration points that C tests cannot validate:

  • FFI boundary integrity
  • Lua async operations
  • System integration (git)
  • UI behavior (scrolling, rendering)

Total: 46 tests across 5 spec files using industry-standard plenary.nvim framework.

What's NOT Covered

Diff algorithm - Validated by C tests in c-diff-core/tests/ (3,490 lines) ❌ Visual correctness - Manual testing required