Skip to content

Add array element tests - #296

Merged
josesimoes merged 2 commits into
nanoframework:developfrom
josesimoes:array-elements-tests
Nov 12, 2026
Merged

josesimoes merged 2 commits into
nanoframework:developfrom
josesimoes:array-elements-tests

Conversation

@josesimoes

@josesimoes josesimoes commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Description

  • Add tests for arrays of generic types: casts, typeof, GetElementType, Array.Copy, stelem, nested and jagged arrays.

Motivation and Context

How Has This Been Tested?

  • [tested against nanoclr BuildId 68015]

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.

Assisted by: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for arrays containing closed generic types, including type checks, casts, reflection, array creation, element storage, and copying.
    • Added coverage for generic arrays in generic code, nested and jagged arrays, and iteration over generic and jagged arrays.
    • Added checks confirming that non-generic array behavior remains unchanged.

This PR adds a reflection test class for generic array element behavior and includes it in the test project. The tests cover type identity, reflection, array operations, nested arrays, and enumeration.

Changes: Generic Array Element Tests

Layer / File(s) Summary
Type identity and reflection
Tests/NFUnitTestSystemLibReflection/NFUnitTestSystemLibReflection.nfproj, Tests/NFUnitTestSystemLibReflection/UnitTestGenericArrayElementTests.cs
Adds tests for casts, type checks, closed generic array types, and reflected members on generic element types. The project includes the new test class.
Array creation and operations
Tests/NFUnitTestSystemLibReflection/UnitTestGenericArrayElementTests.cs
Adds tests for generic-element array creation, type checks, stores, copies, and operations in generic code.
Nested arrays and enumeration
Tests/NFUnitTestSystemLibReflection/UnitTestGenericArrayElementTests.cs
Adds tests for nested and jagged generic arrays, enumeration, and existing non-generic array behavior. Private generic helper types support the tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to da59f

This PR adds unit tests for generic array element behavior and registers them in the test project. It does not change production code, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Add array element tests" matches the main change: the PR adds a new test class covering arrays of generic types, including casts, typeof, GetElementType, Array.Copy, stelem, and nested and …
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 tests for arrays of generic types, covering casts, typeof, GetElementType, Array.Copy, stelem, and nested and jagged arrays. The changeset adds UnitTestGenericArrayE…
Full details: Title check

Explanation

The title "Add array element tests" matches the main change: the PR adds a new test class covering arrays of generic types, including casts, typeof, GetElementType, Array.Copy, stelem, and nested and jagged arrays. It is 23 characters, under the 50-character guideline. It does not reference other PRs or issues and does not end with a full stop. It is somewhat broad but still describes the change accurately.

Full details: Description check

Explanation

The description states the PR adds tests for arrays of generic types, covering casts, typeof, GetElementType, Array.Copy, stelem, and nested and jagged arrays. The changeset adds UnitTestGenericArrayElementTests.cs with tests for exactly these areas and includes it in the test project. The description is related to the changeset and is not off-topic.

  • 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: e74f755d-d0ee-498f-ab43-4ca735607243
Commits

Reviewing files that changed from the base of the PR and between 06f92fc and da59fa5.

Files selected for processing: 2

  • Tests/NFUnitTestSystemLibReflection/NFUnitTestSystemLibReflection.nfproj
  • Tests/NFUnitTestSystemLibReflection/UnitTestGenericArrayElementTests.cs

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

@josesimoes

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 11, 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.

@josesimoes

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@sonarqubecloud

Copy link
Copy Markdown

@josesimoes
josesimoes merged commit 9413ef3 into nanoframework:develop Nov 12, 2026
7 checks passed
@josesimoes
josesimoes deleted the array-elements-tests branch November 12, 2026 09:05
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