
kevmoo/source_gen_test
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
패키지에 대한 강력한 테스트를 만드는 API를 테스트:source gen 발전기
개요
테스트 파일에 의해 package:source gen에서 파생된 발전기를 테스트하는 것은 쉽습니다. 출력 자체에서 테스트를 작성하고 싶다면 황금 출력 파일에 대해 테스트하십시오. cartesianProduct 및 validGeneratorBatch를 사용하여 단일 공유 패키지의 Generator 또는 GeneratorForAnnotation에 대한 AST / declaration permutations의 큰 매트릭스를 검증합니다. spawnUri 런타임 패스: 패키지:source gen test는 스트레스 테스트 발전기 및 GeneratorForAnnotation 구현을 위한 번들 소스 테스트 후제 에이전트 기술을 배로합니다. cartesianProduct 및 checkGeneratorBatch. 패키지가 dev dependencies의 source gen test에 따라 달라집니다. 패키지에 의존하는 모든 번들 기술을 설치합니다.:skills: GitHub에서 직접 기술을 설치:
개요(AI 번역)
Generators]에서 파생된 package:source_gen를 테스트하기 쉬운
annotating 테스트 파일.
출력에 대한 테스트를 작성하려는 경우 황금 출력 파일에 대한 테스트 기타.
다른 돕는 또한 제공됩니다.
결합 배치 검증 (verifyGeneratorBatch)
cartesianProduct과 verifyGeneratorBatch]를 사용하여 큰 매트를 검증
Generator 또는 GeneratorForAnnotation]에 대한 AST/declaration permutations
단일 공유 package:analyzer 컨텍스트 및 배치 Isolate.spawnUri]
런타임 패스:
AI 에이전트 기술 (source-gen-test-fuzz)
package:source_gen_test 배는 번들
source-gen-test-fuzz 에이전트 기술
스트레스 테스트 Generator 과 GeneratorForAnnotation] 와 구현
cartesianProduct 및 verifyGeneratorBatch].
패키지가 source_gen_test]에 따라 달라집니다. dev_dependencies
신뢰할 수 있는 능력과
package:skills:
GitHub에서 직접 기술을 설치:
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
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.
Combinatorial Batch Verification (verifyGeneratorBatch)
Use cartesianProduct and verifyGeneratorBatch to validate large matrices of
AST/declaration permutations against a Generator or GeneratorForAnnotation
in a single shared package:analyzer context and batched Isolate.spawnUri
runtime pass:
final axes = cartesianProduct({
'fieldType': ['int', 'int?', 'List'],
'includeIfNull': ['true', 'false'],
});
final report = await verifyGeneratorBatch(
generator: MyGenerator(),
imports: const ["import 'package:my_pkg/annotations.dart';"],
cases: [
for (var i = 0; i < axes.length; i++)
CodegenCase(
id: 'case_$i',
declarations: '''
@MyAnnotation(includeIfNull: ${axes[i]['includeIfNull']})
class Case$i {
final ${axes[i]['fieldType']} value;
Case$i(this.value);
}
''',
runtimeCheck: 'final c = Case$i(null);',
),
],
);
AI Agent Skill (source-gen-test-fuzz)
package:source_gen_test ships a bundled
source-gen-test-fuzz agent skill for
stress-testing Generator and GeneratorForAnnotation implementations with
cartesianProduct and verifyGeneratorBatch.
If your package depends on source_gen_test in dev_dependencies, install all
bundled skills from your dependencies with
package:skills:
dart run skills@ get
Or install the skill directly from GitHub:
dart run skills@ add kevmoo/source_gen_test --skill source-gen-test-fuzz
# or
npx skills add kevmoo/source_gen_test --skill source-gen-test-fuzz
추천 도구
다른 키워드를 입력하거나 필터를 제거해 보세요.
설치
npx skillfish add kevmoo/source_gen_test