Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional VerificationEngine improvements/features #5472

Merged
merged 4 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ internal class VerifyCommand : ExecutableCommand<VerifyCommandArgs>
Description = LocalizableStrings.command_verify_help_expectationsDirPath_description,
};

private readonly Option<string> _scenarioDistinguisherOption = new(new[] { "--distinguisher-name" })
JanKrivanek marked this conversation as resolved.
Show resolved Hide resolved
{
Description = LocalizableStrings.command_verify_help_distinguisherName_description,
};

private readonly Option<bool> _disableDiffToolOption = new("--disable-diff-tool")
{
Description = LocalizableStrings.command_verify_help_disableDiffTool_description,
Expand All @@ -66,6 +71,12 @@ internal class VerifyCommand : ExecutableCommand<VerifyCommandArgs>
Arity = new ArgumentArity(0, 999)
};

private readonly Option<IEnumerable<string>> _includePatternOption = new("--include-pattern")
{
Description = LocalizableStrings.command_verify_help_customIncludes_description,
Arity = new ArgumentArity(0, 999)
};

private readonly Option<bool> _verifyCommandOutputOption = new("--verify-std")
{
Description = LocalizableStrings.command_verify_help_verifyOutputs_description,
Expand All @@ -92,9 +103,11 @@ public VerifyCommand(ILoggerFactory loggerFactory)
AddOption(_newCommandPathOption);
AddOption(_templateOutputPathOption);
AddOption(_expectationsDirectoryOption);
AddOption(_scenarioDistinguisherOption);
AddOption(_disableDiffToolOption);
AddOption(_disableDefaultExcludePatternsOption);
AddOption(_excludePatternOption);
AddOption(_includePatternOption);
AddOption(_verifyCommandOutputOption);
AddOption(_isCommandExpectedToFailOption);
FromAmongCaseInsensitive(
Expand All @@ -113,10 +126,12 @@ internal static VerifyCommandArgs ExtractArguments(VerifyCommand verifyCommand,
templatePath: parseResult.GetValueForOption(verifyCommand._templatePathOption),
dotnetNewCommandAssemblyPath: parseResult.GetValueForOption(verifyCommand._newCommandPathOption),
expectationsDirectory: parseResult.GetValueForOption(verifyCommand._expectationsDirectoryOption),
scenarioDistinguisher: parseResult.GetValueForOption(verifyCommand._scenarioDistinguisherOption),
outputDirectory: parseResult.GetValueForOption(verifyCommand._templateOutputPathOption),
disableDiffTool: parseResult.GetValueForOption(verifyCommand._disableDiffToolOption),
disableDefaultVerificationExcludePatterns: parseResult.GetValueForOption(verifyCommand._disableDefaultExcludePatternsOption),
verificationExcludePatterns: parseResult.GetValueForOption(verifyCommand._excludePatternOption),
verificationIncludePatterns: parseResult.GetValueForOption(verifyCommand._includePatternOption),
verifyCommandOutput: parseResult.GetValueForOption(verifyCommand._verifyCommandOutputOption),
isCommandExpectedToFail: parseResult.GetValueForOption(verifyCommand._isCommandExpectedToFailOption),
uniqueForOptions: parseResult.GetValueForOption(verifyCommand._uniqueForOption));
Expand All @@ -136,8 +151,10 @@ protected override async Task<int> ExecuteAsync(VerifyCommandArgs args, Cancella
DisableDiffTool = args.DisableDiffTool,
DisableDefaultVerificationExcludePatterns = args.DisableDefaultVerificationExcludePatterns,
VerificationExcludePatterns = args.VerificationExcludePatterns,
VerificationIncludePatterns = args.VerificationIncludePatterns,
DotnetNewCommandAssemblyPath = args.DotnetNewCommandAssemblyPath,
ExpectationsDirectory = args.ExpectationsDirectory,
ScenarioDistinguisher = args.ScenarioDistinguisher,
OutputDirectory = args.OutputDirectory,
VerifyCommandOutput = args.VerifyCommandOutput,
IsCommandExpectedToFail = args.IsCommandExpectedToFail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ public VerifyCommandArgs(
string? templateSpecificArgs,
string? dotnetNewCommandAssemblyPath,
string? expectationsDirectory,
string? scenarioDistinguisher,
string? outputDirectory,
bool? disableDiffTool,
bool? disableDefaultVerificationExcludePatterns,
IEnumerable<string>? verificationExcludePatterns,
IEnumerable<string>? verificationIncludePatterns,
bool? verifyCommandOutput,
bool isCommandExpectedToFail,
IEnumerable<UniqueForOption>? uniqueForOptions)
Expand All @@ -35,10 +37,12 @@ public VerifyCommandArgs(
TemplatePath = templatePath;
DotnetNewCommandAssemblyPath = dotnetNewCommandAssemblyPath;
ExpectationsDirectory = expectationsDirectory;
ScenarioDistinguisher = scenarioDistinguisher;
OutputDirectory = outputDirectory;
DisableDiffTool = disableDiffTool;
DisableDefaultVerificationExcludePatterns = disableDefaultVerificationExcludePatterns;
VerificationExcludePatterns = verificationExcludePatterns;
VerificationIncludePatterns = verificationIncludePatterns;
VerifyCommandOutput = verifyCommandOutput;
IsCommandExpectedToFail = isCommandExpectedToFail;
UniqueFor = ToUniqueForOptionFlags(uniqueForOptions);
Expand Down Expand Up @@ -69,6 +73,11 @@ public VerifyCommandArgs(
/// </summary>
public string? ExpectationsDirectory { get; init; }

/// <summary>
/// Gets a custom prefix prepended in front of generated scenario name - result used for naming verification subdirectories.
/// </summary>
public string? ScenarioDistinguisher { get; init; }

/// <summary>
/// Gets the target directory to output the generated template.
/// </summary>
Expand All @@ -90,6 +99,12 @@ public VerifyCommandArgs(
/// </summary>
public IEnumerable<string>? VerificationExcludePatterns { get; init; }

/// <summary>
/// Set of patterns defining files to be included into verification (unless excluded by <see cref="VerificationExcludePatterns"/>).
/// By default all files are included (unless excluded).
/// </summary>
public IEnumerable<string>? VerificationIncludePatterns { get; init; }

/// <summary>
/// If set to true - 'dotnet new' command standard output and error contents will be verified along with the produced template files.
/// </summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ Do not localize: "template.json"</comment>
<data name="command_verify_help_customExcludes_description" xml:space="preserve">
<value>Specifies pattern(s) defining files to be excluded from verification.</value>
</data>
<data name="command_verify_help_customIncludes_description" xml:space="preserve">
<value>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</value>
</data>
<data name="command_verify_help_description" xml:space="preserve">
<value>Runs the template with specified arguments and compares the result with expectations files.</value>
</data>
Expand All @@ -182,6 +185,9 @@ Do not localize: "template.json"</comment>
<value>If set to true - the diff tool won't be automatically started by the Verifier on verification failures.</value>
<comment>Do not translate 'true'.</comment>
</data>
<data name="command_verify_help_distinguisherName_description" xml:space="preserve">
<value>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</value>
JanKrivanek marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="command_verify_help_expectationsDirPath_description" xml:space="preserve">
<value>Specifies path to the directory with expectation files.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Do not localize: "template.json"</note>
<target state="translated">Určuje vzory definující soubory, které se mají vyloučit z ověřování.</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_customIncludes_description">
<source>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</source>
<target state="new">Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_description">
<source>Runs the template with specified arguments and compares the result with expectations files.</source>
<target state="translated">Spustí šablonu se zadanými argumenty a porovná výsledek s očekávanými soubory.</target>
Expand All @@ -93,6 +98,11 @@ Do not localize: "template.json"</note>
<target state="translated">Pokud je nastavená hodnota true, nástroj rozdílu se při neúspěšných ověřeních automaticky nespustí.</target>
<note>Do not translate 'true'.</note>
</trans-unit>
<trans-unit id="command_verify_help_distinguisherName_description">
<source>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</source>
<target state="new">Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_expectFailure_description">
<source>If set to true - 'dotnet new' command is expected to return non-zero return code.</source>
<target state="translated">Pokud je nastaveno na true – očekává se, že příkaz dotnet new vrátí nenulový návratový kód.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Do not localize: "template.json"</note>
<target state="translated">Gibt Muster an, die Dateien definieren, die von der Überprüfung ausgeschlossen werden sollen.</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_customIncludes_description">
<source>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</source>
<target state="new">Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_description">
<source>Runs the template with specified arguments and compares the result with expectations files.</source>
<target state="translated">Führt die Vorlage mit angegebenen Argumenten aus und vergleicht das Ergebnis mit den Erwartungsdateien.</target>
Expand All @@ -93,6 +98,11 @@ Do not localize: "template.json"</note>
<target state="translated">Bei Festlegung auf WAHR wird das Diff-Tool bei Überprüfungsfehlern nicht automatisch vom Überprüfer gestartet.</target>
<note>Do not translate 'true'.</note>
</trans-unit>
<trans-unit id="command_verify_help_distinguisherName_description">
<source>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</source>
<target state="new">Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_expectFailure_description">
<source>If set to true - 'dotnet new' command is expected to return non-zero return code.</source>
<target state="translated">Bei Festlegung auf WAHR wird erwartet, dass der Befehl „dotnet new“ einen Rückgabecode ungleich 0 (Null) zurückgibt.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Do not localize: "template.json"</note>
<target state="translated">Especifica los patrones que definen los archivos que se excluirán de la comprobación.</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_customIncludes_description">
<source>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</source>
<target state="new">Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_description">
<source>Runs the template with specified arguments and compares the result with expectations files.</source>
<target state="translated">Ejecuta la plantilla con los argumentos especificados y compara el resultado con los archivos de expectativas.</target>
Expand All @@ -93,6 +98,11 @@ Do not localize: "template.json"</note>
<target state="translated">Si se establece en true, el comprobador no iniciará automáticamente la herramienta de comparación en caso de errores de comprobación.</target>
<note>Do not translate 'true'.</note>
</trans-unit>
<trans-unit id="command_verify_help_distinguisherName_description">
<source>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</source>
<target state="new">Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_expectFailure_description">
<source>If set to true - 'dotnet new' command is expected to return non-zero return code.</source>
<target state="translated">Si se establece en true, se espera que el comando "dotnet new" devuelva código de retorno distinto de cero.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Do not localize: "template.json"</note>
<target state="translated">Spécifie le ou les modèles définissant les fichiers à exclure de la vérification.</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_customIncludes_description">
<source>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</source>
<target state="new">Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_description">
<source>Runs the template with specified arguments and compares the result with expectations files.</source>
<target state="translated">Exécute le modèle avec les arguments spécifiés et compare le résultat aux fichiers attendus.</target>
Expand All @@ -93,6 +98,11 @@ Do not localize: "template.json"</note>
<target state="translated">Si la valeur est définie sur true, l’outil Diff n’est pas automatiquement démarré par le vérificateur en cas d’échecs de vérification.</target>
<note>Do not translate 'true'.</note>
</trans-unit>
<trans-unit id="command_verify_help_distinguisherName_description">
<source>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</source>
<target state="new">Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_expectFailure_description">
<source>If set to true - 'dotnet new' command is expected to return non-zero return code.</source>
<target state="translated">Si la valeur est définie sur true, la commande 'dotnet new' doit retourner un code de retour différent de zéro.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Do not localize: "template.json"</note>
<target state="translated">Specifica i criteri che definiscono i file da escludere dalla verifica.</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_customIncludes_description">
<source>Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</source>
<target state="new">Specifies pattern(s) defining files to be included to verification (all files are included if not specified).</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_description">
<source>Runs the template with specified arguments and compares the result with expectations files.</source>
<target state="translated">Esegue il modello con gli argomenti specificati e confronta il risultato con i file delle aspettative.</target>
Expand All @@ -93,6 +98,11 @@ Do not localize: "template.json"</note>
<target state="translated">Se impostato su true, lo strumento diff non verrà avviato automaticamente da Verifier in eventuali errori di verifica.</target>
<note>Do not translate 'true'.</note>
</trans-unit>
<trans-unit id="command_verify_help_distinguisherName_description">
<source>Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</source>
<target state="new">Sets optional distinguisher string prepended to the generated scenario name used for naming expectations subdirectories</target>
<note />
</trans-unit>
<trans-unit id="command_verify_help_expectFailure_description">
<source>If set to true - 'dotnet new' command is expected to return non-zero return code.</source>
<target state="translated">Se impostato su true, è previsto che il comando 'dotnet new' restituisca codice restituito diverso da zero.</target>
Expand Down
Loading