source_gen_test 1.1.0 copy "source_gen_test: ^1.1.0" to clipboard
source_gen_test: ^1.1.0 copied to clipboard

Test support for the source_gen package. Includes helpers to make it easy to validate both success and failure cases.

Pub package Build Status package publisher

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.

13
likes
160
pub points
74%
popularity

Publisher

verified publisherkevmoo.com

Test support for the source_gen package. Includes helpers to make it easy to validate both success and failure cases.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, build, build_test, dart_style, meta, path, source_gen, test

More

Packages that depend on source_gen_test