v1.4.2
source_gen_test
Test support for the source_gen package. Includes helpers to make it easy to validate both success and failure cases.
13Likes 49.6K30-day downloads160Pub points
macOSWindowsLinux
Test APIs to make it easier to create robust test for package:source_gen Generators
English project snapshot. Visit GitHub for the latest content.
Make it easy to test Generators derived from package:source_gen by
annotating test files.
@ShouldGenerate(
r'''
const TestClass1NameLength = 10;
const TestClass1NameLowerCase = 'testclass1';
''',
configurations: ['default', 'no-prefix-required'],
)
@ShouldThrow(
'Uh...',
configurations: ['vague'],
element: false,
)
@TestAnnotation()
class TestClass1 {}
Test against a golden output file if you also want to write tests on the output itself.
part 'goldens/testclass2.dart';
@ShouldGenerateFile(
'goldens/testclass2.dart',
partOfCurrent: true,
configurations: ['default', 'no-prefix-required'],
)
@ShouldThrow(
'Uh...',
configurations: ['vague'],
element: false,
)
@TestAnnotation()
class TestClass2 {}
Other helpers are also provided.
Dependency list 11 items
>=9.0.0 <15.0.0^4.0.3^3.5.4^3.1.3^1.16.0^1.9.0^4.1.1^1.27.0^0.3.1^1.19.0^3.0.0Start with your use case, compare repository activity, and check the original project before adopting it.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗