FLUTTER ECOSYSTEM

kevmoo/source_gen_test

APIs testen, um robuste Tests für Generatoren des Pakets source_gen einfacher zu erstellen

Projektcover von source_gen_test
Stars
20
Forks
13
Letzter Push (UTC)
12.09.2026
Projektstatus
Aktiv
Kevin Moore GitHub avatar
GITHUB User

Kevin Moore ↗

A Product Manager at @google working on @dart-lang and @flutter web technologies

@dart-lang @flutter @googleSeattle, WA, USAOffizielle Website ↗
SprachenDart

Technische Themen

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 11 Einträge

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Projekt-README ein-/ausklappen

Pub package CI 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.