source_gen_test
source_gen_test copied to clipboard
Test APIs to make it easier to create robust test for package:source_gen Generators
This change adds support for custom output formatting and is inspired by #29 and https://github.com/google/json_serializable.dart/pull/179. I am currently in the process of rewriting the tests in [`xml_serializable`](https://github.com/tnc1997/dart-xml-serializable/blob/4c449910ffbaf6453a50e3fe1ef324066e9a941e/xml_serializable/test/xml_serializable_generator_test.dart) to use this...
The latest source_gen version (1.4.0) added a `node` argument to `InvalidGenerationSourceError` to allow finding the source location from an `AstNode` over an `Element`. Currently, the `@ShouldThrow` annotation doesn't have such...
Hi there 👋 First off, thanks for the great package! ### Note: The below context is maybe helpful but not necessary for the overall question. The TLDR question is at...
This PR adds `ShouldGenerateFile` annotation to expect the match of the generated code against the content of an existing file. - Resolves #31 ## Rationale For an example use, see...
I have large pieces of code generated. Testing for them using `ShouldGenerate` with the inline content makes it hard to read and update. Also I would like to write separate...
Here's the test case: ``` dart @ShouldGenerate( '''class shouldHaveTheCorrectAddressAndPathImpl implements shouldHaveTheCorrectAddressAndPath { Socket socket = io('https://api.robocore.ai', { 'path': '/remote', 'transports': ['websocket'], 'forceNew': true, }); }''', contains: true, expectedLogItems: [ 'onEventElements:...
## Problem Some tests keep failing with such error: ``` `buildLogItems` is not empty. Tests should validate the contents of `buildLogItems` and call `clearBuildLog` before `tearDown`. ``` even after they...