Skip to content

[Repo Assist] test: add FsCheck property tests for NameUtils#1696

Merged
dsyme merged 2 commits intomainfrom
repo-assist/test-nameutils-properties-20260315-87d13cd231a1a6f3
Mar 16, 2026
Merged

[Repo Assist] test: add FsCheck property tests for NameUtils#1696
dsyme merged 2 commits intomainfrom
repo-assist/test-nameutils-properties-20260315-87d13cd231a1a6f3

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.

Adds NameUtilsProperties.fs — 15 FsCheck property-based tests for the NameUtils module, complementing the existing targeted tests in NameUtils.fs.

Motivation

NameUtils is foundational to every type provider (it generates the PascalCase/camelCase member names that users see). The existing tests verify specific examples; property tests verify structural invariants that would catch regressions from any refactor of the segmentation logic.

Properties tested

Function Property
nicePascalName Output contains only alphanumeric chars (multi-char inputs)
nicePascalName Non-empty output starts with uppercase letter or digit (multi-char)
nicePascalName Single PascalCase word "Abc…" is a fixed point
niceCamelName Always equals lowercase-first(nicePascalName)
niceCamelName Output contains only alphanumeric chars (multi-char inputs)
niceCamelName Non-empty output starts with lowercase letter or digit (multi-char)
capitalizeFirstLetter Idempotent
capitalizeFirstLetter Letter-first output starts with uppercase
uniqueGenerator No duplicates for N same-input calls
uniqueGenerator No duplicates across 50 mixed inputs
uniqueGenerator First call result = nicePascalName of input (or "Unnamed" for empty)
trimHtml Idempotent
trimHtml Plain text (no angle brackets) → TrimEnd of original
trimHtml Output never contains < (note: stray > without < passes through by design)

The tests document the edge cases that aren't obvious from the source: single-char strings are returned as-is via ToUpperInvariant (bypassing the segment filter), and a stray > without a matching < is not treated as a tag close.

Test Status

  • ✅ Build: succeeded (3 pre-existing warnings, 0 errors)
  • ✅ All 2893 Core tests pass (33 new property tests, 2860 existing tests)
  • ✅ Formatting: Fantomas applied

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Add NameUtilsProperties.fs with 15 property-based tests covering:
- nicePascalName: alphanumeric output (multi-char), uppercase-first
  invariant, single-PascalCase-word fixed point
- niceCamelName: consistency with nicePascalName (lowercase-first),
  alphanumeric and lowercase-first invariants for multi-char inputs
- capitalizeFirstLetter: idempotency, uppercase-first for letter inputs
- uniqueGenerator: no duplicates for same-input or mixed-input sequences,
  first-result equals nicePascalName
- trimHtml: idempotency, no-op on angle-bracket-free text, no '<' in output

Test comments document edge cases (single-char passthrough, stray '>').
All 2893 Core tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review March 15, 2026 23:30
@dsyme dsyme merged commit 76c192b into main Mar 16, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/test-nameutils-properties-20260315-87d13cd231a1a6f3 branch March 16, 2026 01:00
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.

1 participant