package options_test

import (
	"testing"

	"github.com/buildbuddy-io/buildbuddy/cli/parser/options"
	"github.com/buildbuddy-io/buildbuddy/cli/parser/options/flag_form"
	"github.com/stretchr/testify/assert"
)

func RequiredValueDefinition(name, oldname, shortname string, opts ...options.DefinitionOpt) *options.Definition {
	return options.NewDefinition(
		name,
		append(
			[]options.DefinitionOpt{
				options.WithOldName(oldname),
				options.WithShortName(shortname),
				options.WithRequiresValue(),
			},
			opts...,
		)...,
	)
}

func BoolOrEnumDefinition(name, oldname, shortname string, opts ...options.DefinitionOpt) *options.Definition {
	return options.NewDefinition(
		name,
		append(
			[]options.DefinitionOpt{
				options.WithOldName(oldname),
				options.WithShortName(shortname),
				options.WithNegative(),
			},
			opts...,
		)...,
	)
}

func ExpansionDefinition(name, oldname, shortname string, opts ...options.DefinitionOpt) *options.Definition {
	return options.NewDefinition(
		name,
		append(
			[]options.DefinitionOpt{
				options.WithOldName(oldname),
				options.WithShortName(shortname),
			},
			opts...,
		)...,
	)
}

func TestRequiredValueOptionBase(t *testing.T) {
	name := "name"
	noName := "noname"
	oldName := "experimental_name"
	noOldName := "noexperimental_name"
	shortName := "n"
	badName := "badname"
	badShortName := "x"

	t.Run("Required value option base with name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			RequiredValueDefinition(name, "", ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Required value option base with name and old name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			RequiredValueDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Required value option base with name and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			RequiredValueDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Required value option base with name, old name, and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			RequiredValueDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Required value option base with name and old name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			RequiredValueDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Required value option base with name, old name, and short name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			RequiredValueDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Required value option base with name and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			RequiredValueDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
	})

	t.Run("Required value option base with name, old name, and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			RequiredValueDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
	})

	t.Run("Required value option base with name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			RequiredValueDefinition(name, "", ""),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name and old name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			RequiredValueDefinition(name, oldName, ""),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name and short name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			RequiredValueDefinition(name, "", shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name, old name, and short name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			RequiredValueDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name and old name from negative old name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noOldName,
			RequiredValueDefinition(name, oldName, ""),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name, old name, and short name from negative old name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noOldName,
			RequiredValueDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name, old name, and short name from invalid name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badName,
			RequiredValueDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Required value option base with name, old name, and short name from invalid short name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badShortName,
			RequiredValueDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})
}

func TestBoolOrEnumOptionBase(t *testing.T) {
	name := "name"
	noName := "noname"
	oldName := "experimental_name"
	noOldName := "noexperimental_name"
	shortName := "n"
	badName := "badname"
	badShortName := "x"

	t.Run("Bool or enum option base with name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			BoolOrEnumDefinition(name, "", ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name and old name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			BoolOrEnumDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			BoolOrEnumDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			BoolOrEnumDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name and old name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			BoolOrEnumDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.Equal(t, "--"+noOldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.Equal(t, "--"+noOldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Bool or enum option base with name and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			BoolOrEnumDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name from negative name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noName,
			BoolOrEnumDefinition(name, "", ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())

		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
	})

	t.Run("Bool or enum option base with name and old name from negative name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noName,
			BoolOrEnumDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name and short name from negative name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noName,
			BoolOrEnumDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())

		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from negative name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.Equal(t, "--"+noName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Bool or enum option base with name and old name from negative old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noOldName,
			BoolOrEnumDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())

		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.Equal(t, "--"+noOldName, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from negative old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			noOldName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.NegativeName, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+noOldName, base.Format())
		assert.True(t, base.Negative())

		base.SetNegative()
		assert.True(t, base.Negative())
		assert.Equal(t, flag_form.NegativeOldName, base.Form)
		assert.Equal(t, "--"+noOldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Bool or enum option base with name, old name, and short name from invalid name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Bool or enum option base with name, old name, and short name from invalid short name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badShortName,
			BoolOrEnumDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})
}

func TestExpansionOptionBase(t *testing.T) {
	name := "name"
	noName := "noname"
	oldName := "experimental_name"
	noOldName := "noexperimental_name"
	shortName := "n"
	badName := "badname"
	badShortName := "x"

	t.Run("Expansion option base with name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			ExpansionDefinition(name, "", ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Expansion option base with name and old name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			ExpansionDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Expansion option base with name and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			ExpansionDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Expansion option base with name, old name, and short name from name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			name,
			ExpansionDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.Name, base.Form)
		assert.Equal(t, "--"+name, base.Format())
	})

	t.Run("Expansion option base with name and old name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			ExpansionDefinition(name, oldName, ""),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Expansion option base with name, old name, and short name from old name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			oldName,
			ExpansionDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.Equal(t, "--"+oldName, base.Format())
	})

	t.Run("Expansion option base with name and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			ExpansionDefinition(name, "", shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
	})

	t.Run("Expansion option base with name, old name, and short name from short name", func(t *testing.T) {
		base, err := options.NewOptionBase(
			shortName,
			ExpansionDefinition(name, oldName, shortName),
		)

		assert.NoError(t, err)
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseName()
		assert.Equal(t, flag_form.Name, base.Form)
		assert.True(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+name, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())
		base.UseOldName()
		assert.Equal(t, flag_form.OldName, base.Form)
		assert.False(t, base.UsesName())
		assert.True(t, base.UsesOldName())
		assert.False(t, base.UsesShortName())
		assert.Equal(t, "--"+oldName, base.Format())
		assert.False(t, base.Negative())
		base.UseShortName()
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.False(t, base.UsesName())
		assert.False(t, base.UsesOldName())
		assert.True(t, base.UsesShortName())
		assert.Equal(t, "-"+shortName, base.Format())
		assert.False(t, base.Negative())

		base.SetNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
		base.ClearNegative()
		assert.False(t, base.Negative())
		assert.Equal(t, flag_form.ShortName, base.Form)
		assert.Equal(t, "-"+shortName, base.Format())
	})

	t.Run("Expansion option base with name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			ExpansionDefinition(name, "", ""),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name and old name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			ExpansionDefinition(name, oldName, ""),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name and short name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			ExpansionDefinition(name, "", shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name, old name, and short name from negative name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noName,
			ExpansionDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name and old name from negative old name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noOldName,
			ExpansionDefinition(name, oldName, ""),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name, old name, and short name from negative old name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			noOldName,
			ExpansionDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name, old name, and short name from invalid name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badName,
			ExpansionDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})

	t.Run("Expansion option base with name, old name, and short name from invalid short name", func(t *testing.T) {
		_, err := options.NewOptionBase(
			badShortName,
			ExpansionDefinition(name, oldName, shortName),
		)
		assert.Error(t, err)
	})
}
