Skip to content

Conversation

@bfung
Copy link

@bfung bfung commented Jan 15, 2026

Summary

Adds testing on top of #1583

  • Introduces trybuild to validate that macros fail during compilation when used improperly.
  • Adds some documentation for running tests with trybuild and running code coverage.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

> ./scripts/checks.sh && ./scripts/check_deny.sh

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

References

bfung and others added 3 commits January 15, 2026 13:54
Changed "mainting" to "maintaining" in the doc comment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Added trybuild-based compile-time tests following TDD principles:

Tests added (tests/compiler/function/example/):
- Valid usage with trailing commas (pass.rs)
- Duplicate field detection (3 tests with .stderr)
- Missing field detection (3 tests with .stderr)
- Unknown field detection (1 test with .stderr)

Macro improvements (src/compiler/function.rs):
- Added duplicate field error handling with compile_error!
- Enhanced documentation with compile_fail examples
- Added test_example_macro_trailing_commas unit test

Infrastructure:
- Added trybuild dev dependency (Cargo.toml)
- Created tests/trybuild.rs test suite with organized structure
- Added tests/README.md documenting trybuild workflow

Test organization mirrors source structure:
  src/compiler/function.rs → tests/compiler/function/example/

All tests pass including unit tests, doc tests, and trybuild tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Added COVERAGE.md with quick start guide for running cargo-llvm-cov
coverage reports.

Includes:
- Installation and basic usage commands
- HTML report location
- Text summary commands
- Note about trybuild tests not appearing in coverage
- Current project coverage baseline (~74% lines, ~68% functions)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@bfung bfung requested a review from a team as a code owner January 15, 2026 23:23
bfung and others added 3 commits January 15, 2026 17:27
Pin trybuild dev dependency to specific version for reproducible builds.

Verified all trybuild tests pass with pinned version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Replaced hardcoded year values in test expectations with a {CURRENT_YEAR}
placeholder that gets replaced at test runtime with the actual current year.
This prevents tests from failing when the year changes.

Changes:
- Added replace_current_year_placeholder() helper function in test framework
- Updated parse_klog and parse_linux_authorization tests to use placeholder
- Refactored duplicate code following DRY principles

All 801 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Updated cargo-deny from version 0.18.3 to 0.19.0 to resolve the
"unsupported CVSS version: 4.0" error that occurs when parsing the
RustSec advisory database.

The fix was introduced in cargo-deny 0.18.6 by updating the rustsec
dependency to version 0.31, which includes CVSS 4.0 support.

Changes:
- Updated cargo-deny version in scripts/check_deny.sh from 0.18.3 to 0.19.0
- Verified all checks pass: advisories, bans, licenses, and sources

References:
- GitHub Issue: EmbarkStudios/cargo-deny#804
- Fix PR: EmbarkStudios/cargo-deny#805

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
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