Skip to content

test(yet_another_json_isolate): add full coverage test suite#1583

Open
spydon wants to merge 2 commits into
mainfrom
test/yet-another-json-isolate-coverage
Open

test(yet_another_json_isolate): add full coverage test suite#1583
spydon wants to merge 2 commits into
mainfrom
test/yet-another-json-isolate-coverage

Conversation

@spydon

@spydon spydon commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Expands the test suite for yet_another_json_isolate from 4 tests to a comprehensive suite covering all reachable code paths.

Line coverage of lib/src/_isolates_io.dart goes from 49/63 to 59/63. The only remaining uncovered lines are the RemoteError (native error) branch in _handleRes, which is defensive code that is unreachable through the public API: it only fires when a non-bool method flag reaches the isolate, and the public decode/encode methods always send [input, bool].

Coverage added

  • Initialization: both manual initialize() and lazy first-call initialization, for decode and encode.
  • Data types: top-level lists, nested structures, ints/doubles/booleans/null/strings, unicode, bare JSON primitives, and encode/decode round trips.
  • Error handling: FormatException on invalid JSON, JsonUnsupportedObjectError on non-encodable objects, and verification that the isolate stays usable after a decode or encode error.
  • Concurrency and ordering: concurrent decodes, interleaved encodes/decodes, and many sequential operations all resolve to the correct results in order.
  • Lifecycle: dispose on a lazily initialized isolate, and two isolates operating independently.

Two io-specific behaviors (debugName getter, and the double-initialize() assertion) live in a separate @TestOn('vm') file so the shared suite compiles and passes on both the VM and web (dart2js/chrome) targets.

Verification

  • dart test (VM): all pass
  • dart test -p chrome (web): all pass
  • dart analyze: no issues
  • dart format: clean

@spydon spydon requested a review from a team as a code owner July 10, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant