Cleanup: fix formatting of test cases

This commit is contained in:
Stefan Haller 2025-05-08 09:19:16 +02:00
parent e4c1583fb7
commit b1f8aa6c9e

View file

@ -16,7 +16,8 @@ func TestCommitPrefixMigrations(t *testing.T) {
name: "Empty String", name: "Empty String",
input: "", input: "",
expected: "", expected: "",
}, { },
{
name: "Single CommitPrefix Rename", name: "Single CommitPrefix Rename",
input: `git: input: `git:
commitPrefix: commitPrefix:
@ -28,7 +29,8 @@ func TestCommitPrefixMigrations(t *testing.T) {
- pattern: "^\\w+-\\w+.*" - pattern: "^\\w+-\\w+.*"
replace: '[JIRA $0] ' replace: '[JIRA $0] '
`, `,
}, { },
{
name: "Complicated CommitPrefixes Rename", name: "Complicated CommitPrefixes Rename",
input: `git: input: `git:
commitPrefixes: commitPrefixes:
@ -48,11 +50,13 @@ func TestCommitPrefixMigrations(t *testing.T) {
- pattern: "^foo.bar*" - pattern: "^foo.bar*"
replace: '[FUN $0] ' replace: '[FUN $0] '
`, `,
}, { },
{
name: "Incomplete Configuration", name: "Incomplete Configuration",
input: "git:", input: "git:",
expected: "git:", expected: "git:",
}, { },
{
// This test intentionally uses non-standard indentation to test that the migration // This test intentionally uses non-standard indentation to test that the migration
// does not change the input. // does not change the input.
name: "No changes made when already migrated", name: "No changes made when already migrated",
@ -96,7 +100,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
name: "Empty String", name: "Empty String",
input: "", input: "",
expected: "", expected: "",
}, { },
{
name: "Convert subprocess to output=terminal", name: "Convert subprocess to output=terminal",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -106,7 +111,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
- command: echo 'hello' - command: echo 'hello'
output: terminal output: terminal
`, `,
}, { },
{
name: "Convert stream to output=log", name: "Convert stream to output=log",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -116,7 +122,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
- command: echo 'hello' - command: echo 'hello'
output: log output: log
`, `,
}, { },
{
name: "Convert showOutput to output=popup", name: "Convert showOutput to output=popup",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -126,7 +133,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
- command: echo 'hello' - command: echo 'hello'
output: popup output: popup
`, `,
}, { },
{
name: "Subprocess wins over the other two", name: "Subprocess wins over the other two",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -138,7 +146,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
- command: echo 'hello' - command: echo 'hello'
output: terminal output: terminal
`, `,
}, { },
{
name: "Stream wins over showOutput", name: "Stream wins over showOutput",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -149,7 +158,8 @@ func TestCustomCommandsOutputMigration(t *testing.T) {
- command: echo 'hello' - command: echo 'hello'
output: log output: log
`, `,
}, { },
{
name: "Explicitly setting to false doesn't create an output=none key", name: "Explicitly setting to false doesn't create an output=none key",
input: `customCommands: input: `customCommands:
- command: echo 'hello' - command: echo 'hello'
@ -790,7 +800,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
name: "Incomplete Configuration Passes uneventfully", name: "Incomplete Configuration Passes uneventfully",
input: "git:", input: "git:",
expected: "git:", expected: "git:",
}, { },
{
name: "Single Cmd with no Cmds", name: "Single Cmd with no Cmds",
input: `git: input: `git:
allBranchesLogCmd: git log --graph --oneline allBranchesLogCmd: git log --graph --oneline
@ -799,7 +810,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
allBranchesLogCmds: allBranchesLogCmds:
- git log --graph --oneline - git log --graph --oneline
`, `,
}, { },
{
name: "Cmd with one existing Cmds", name: "Cmd with one existing Cmds",
input: `git: input: `git:
allBranchesLogCmd: git log --graph --oneline allBranchesLogCmd: git log --graph --oneline
@ -811,7 +823,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
- git log --graph --oneline - git log --graph --oneline
- git log --graph --oneline --pretty - git log --graph --oneline --pretty
`, `,
}, { },
{
name: "Only Cmds set have no changes", name: "Only Cmds set have no changes",
input: `git: input: `git:
allBranchesLogCmds: allBranchesLogCmds:
@ -821,7 +834,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
allBranchesLogCmds: allBranchesLogCmds:
- git log - git log
`, `,
}, { },
{
name: "Removes Empty Cmd When at end of yaml", name: "Removes Empty Cmd When at end of yaml",
input: `git: input: `git:
allBranchesLogCmds: allBranchesLogCmds:
@ -832,7 +846,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
allBranchesLogCmds: allBranchesLogCmds:
- git log --graph --oneline - git log --graph --oneline
`, `,
}, { },
{
name: "Migrates when sequence defined inline", name: "Migrates when sequence defined inline",
input: `git: input: `git:
allBranchesLogCmds: [foo, bar] allBranchesLogCmds: [foo, bar]
@ -841,7 +856,8 @@ func TestAllBranchesLogCmdMigrations(t *testing.T) {
expected: `git: expected: `git:
allBranchesLogCmds: [baz, foo, bar] allBranchesLogCmds: [baz, foo, bar]
`, `,
}, { },
{
name: "Removes Empty Cmd With Keys Afterwards", name: "Removes Empty Cmd With Keys Afterwards",
input: `git: input: `git:
allBranchesLogCmds: allBranchesLogCmds: