test method
Define test code. The path path is passed relative to lib, sourcePath is the source file path, baseName is the filename, and className is the filename converted to Pascal case.
テストコードを定義します。pathにlibからの相対パス、sourcePathにソースファイルのパス、baseNameにファイル名が渡され、classNameにファイル名をパスカルケースに変換した値が渡されます。
Implementation
@override
String test(
String path, String sourcePath, String baseName, String className) {
final packageName = retrievePackageName();
return """
import "package:masamune_test/masamune_test.dart";
import "package:$packageName/pages/$sourcePath.dart";
void main() {
masamunePageTest(
name: "${className}Page",
path: "$sourcePath",
builder: (context, ref, value) {
// TODO: Write test code.
return const ${className}Page();
},
);
}
""";
}