Skip to content

Add tests for enum arguments of custom attributes - #319

Open
josesimoes wants to merge 1 commit into
nanoframework:developfrom
josesimoes:enum-attribute-tests
Open

josesimoes wants to merge 1 commit into
nanoframework:developfrom
josesimoes:enum-attribute-tests

Conversation

@josesimoes

@josesimoes josesimoes commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

  • Add tests reading enum arguments from GetCustomAttributes on types, fields and methods: single argument, several attributes, mixed with int and string, in params object[], enums of different underlying types, enum from CoreLibrary.
  • Add DataRow tests with enum arguments.

Motivation and Context

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

🤖 Generated with Claude Code

- Enum arguments in constructors, object arrays and DataRow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for enum values used in attributes on types, fields, and methods, including nested and core-library enums.
    • Added checks for mixed attribute arguments, enum values stored in object arrays, and data rows with single or multiple enum parameters.
    • Included enums with different underlying numeric types.

This change adds attribute argument tests for enum values across class, field, and method attributes, object arrays, core-library enums, and data rows. The test project now compiles the new test file.

Changes: Enum attribute argument coverage

Layer / File(s) Summary
Enum attribute fixtures
Tests/NFUnitTestAttributes/EnumAttributeArgumentTests.cs, Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj
Adds enum types, attribute classes, and decorated members for the test cases. Adds the test file to the project’s compile items.
Enum argument assertions
Tests/NFUnitTestAttributes/EnumAttributeArgumentTests.cs
Adds assertions for enum values on class, field, and method attributes; mixed and object-array arguments; core-library enums; and enum data-row arguments.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: Minimal · up to e96b1

This change adds test coverage for enum arguments in custom attributes and does not alter production behavior. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Add tests for enum arguments of custom attributes" matches the main change. The PR adds unit tests in EnumAttributeArgumentTests.cs that read enum arguments from custom attributes on types,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the PR adds unit tests for enum arguments read through GetCustomAttributes on types, fields and methods, plus DataRow tests with enum arguments. This matches the changeset, whic…
Full details: Title check

Explanation

The title "Add tests for enum arguments of custom attributes" matches the main change. The PR adds unit tests in EnumAttributeArgumentTests.cs that read enum arguments from custom attributes on types, fields, and methods. The title is 49 characters, under the 50-character guideline, has no PR or issue references, and does not end with a full stop.

Full details: Description check

Explanation

The description states the PR adds unit tests for enum arguments read through GetCustomAttributes on types, fields and methods, plus DataRow tests with enum arguments. This matches the changeset, which adds EnumAttributeArgumentTests.cs with those test cases. It also gives the motivation: enum attribute arguments made the unit test launcher abort with CLR_E_WRONG_TYPE. The description is related to the changes, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7e86875d-f74b-4a6d-b2ab-4470c7359ed8
Commits

Reviewing files that changed from the base of the PR and between 1e1c0d3 and e96b198.

Files selected for processing: 2

  • Tests/NFUnitTestAttributes/EnumAttributeArgumentTests.cs
  • Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Finishing Touches
Fix failing CI checks

  • Create a new PR

@josesimoes

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants