Skip to content

Reconcile logic for JSON writing between {non-,}Embedded Swift. - #1950

Merged
grynspan merged 2 commits into
mainfrom
jgrynspan/non-optional-json-path
Oct 8, 2026
Merged

grynspan merged 2 commits into
mainfrom
jgrynspan/non-optional-json-path

Conversation

@grynspan

@grynspan grynspan commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This PR adjusts the logic we use to write JSON to be as close as is reasonable between the Embedded and non-Embedded paths in our shared entry point function.

I've factored out the logic for creating a JSON output stream to a new type, JSON.Writer. In non-Embedded Swift, it just opens a file handle and writes to that. In Embedded Swift, it handles the _swift_testing_writeJSON() abstraction.

As part of this change, I've eliminated the concept of a "default" JSON destination in Embedded Swift. For implementations that really need or want a default destination, they can specify that some path string is the default (e.g. "default" or the empty string).

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adjusts the logic we use to write JSON to be as close as is reasonable
between the Embedded and non-Embedded paths in our shared entry point function.

I've factored out the logic for creating a JSON output stream to a new type,
`JSON.Writer`. In non-Embedded Swift, it just opens a file handle and writes to
that. In Embedded Swift, it handles the `_swift_testing_writeJSON()` abstraction.

As part of this change, I've eliminated the concept of a "default" JSON
destination in Embedded Swift. For implementations that really need or want a
default destination, they can specify that some `path` string is the default
(e.g. `"default"` or the empty string).
@grynspan grynspan added this to the Swift 6.5.0 (main) milestone Oct 8, 2026
@grynspan grynspan self-assigned this Oct 8, 2026
@grynspan grynspan added tools integration 🛠️ Integration of swift-testing into tools/IDEs embedded-swift 📟 Embedded Swift issues platform-abstraction-layer labels Oct 8, 2026
@grynspan
grynspan merged commit 19a5ead into main Oct 8, 2026
26 of 27 checks passed
@grynspan
grynspan deleted the jgrynspan/non-optional-json-path branch October 8, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

embedded-swift 📟 Embedded Swift issues platform-abstraction-layer tools integration 🛠️ Integration of swift-testing into tools/IDEs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants