Skip to content

[Repo Assist] test: add 39 unit tests for XmlRuntime methods#1764

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/test-xmlruntime-2026-04-27-clean-97d54c741a188241
Draft

[Repo Assist] test: add 39 unit tests for XmlRuntime methods#1764
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/test-xmlruntime-2026-04-27-clean-97d54c741a188241

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

FSharp.Data.Runtime.XmlRuntime is the static helper class generated code relies on for XML type provider support. It had 449 lines of source code but only 6 tests, leaving the majority of its API untested.

Changes

  • tests/FSharp.Data.Core.Tests/XmlRuntime.fs — 39 new tests covering:
    • TryGetValue — empty element → None; element with text → Some; empty-string value → None
    • TryGetAttribute — absent attribute → None; present attribute → Some; namespace-qualified attribute name
    • GetChild — single matching child; zero children → exception; multiple children → exception
    • ConvertArray — empty; multiple values; filters by element name; pipe-separated path navigation ("parent|child")
    • ConvertOptional — zero children → None; one child → Some; multiple children → exception
    • ConvertOptional2 — absent; inner function returns None; inner function returns Some
    • ConvertAsName — name mismatch → None; name match → Some
    • GetJsonValue — valid embedded JSON; empty element → exception
    • TryGetJsonValue — empty element → None; invalid JSON → None; valid JSON → Some
    • CreateValue — string, int, true, false
    • CreateRecord — no content; with attributes; text value; named child element; DateTime (date-only); DateTime (with time); option<string> Some; option<string> None omits child element

Test Status

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

Cover previously untested public API on XmlRuntime:
- TryGetValue (empty/non-empty element)
- TryGetAttribute (absent/present/namespaced attribute)
- GetChild (single/zero/multiple children)
- ConvertArray (empty, multiple, filtered by name, pipe-path)
- ConvertOptional (zero/one/many children)
- ConvertOptional2 (absent/inner-None/inner-Some)
- ConvertAsName (name mismatch/match)
- GetJsonValue (valid JSON/empty element throws)
- TryGetJsonValue (empty/invalid/valid JSON)
- CreateValue (string, int, bool)
- CreateRecord (no content, attributes, text value, child elements,
  DateTime, DateTime with time, optional Some/None)

All 45 XmlRuntime tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

0 participants