mocks

package
v0.0.0-...-91cc2b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const EmptyMakefileContent = ".PHONY: build test snapshot release"

EmptyMakefileContent is the content of the minimal Makefile, used for testing

View Source
const EmptyVersionsAlternateYAML = `id: ch.open.kaeter:unit-testing
type: Makefile
versioning: SemVer
versions:
  0.0.0: 1970-01-01T00:00:00Z|INIT`

EmptyVersionsAlternateYAML is a minimal kaeter versions file content with a differen module id

View Source
const EmptyVersionsGoWorkDepYAML = `` /* 133-byte string literal not displayed */

EmptyVersionsGoWorkDepYAML is the content of a minimal kaeter versions file with a declared dependency on go.work, useful for dependency related tests

View Source
const EmptyVersionsGoWorkLeadingSlashDepYAML = `` /* 134-byte string literal not displayed */

EmptyVersionsGoWorkLeadingSlashDepYAML is EmptyVersionsGoWorkDepYAML with the dependency written as "/go.work", for tests of dependency path normalization

View Source
const EmptyVersionsYAML = `id: ch.open.kaeter:unit-test
type: Makefile
versioning: SemVer
versions:
  0.0.0: 1970-01-01T00:00:00Z|INIT`

EmptyVersionsYAML is the content of a minimal kaeter versions file, used for testing

View Source
const PendingAutoreleaseVersionsYAML = `` /* 149-byte string literal not displayed */

PendingAutoreleaseVersionsYAML is the content of a minimal kaeter versions file with a 1.0.0 AUTORELEASE pending.

View Source
const TouchMakefileContent = ".PHONY: build test release\nbuild:\n\ttouch build\ntest:\n\ttouch test\nrelease:\n\ttouch release"

TouchMakefileContent is a makefile useful for testing releases and such each target will simply touch a file matching the target name allowing easily checking from the outside if targets were called or not.

Variables

This section is empty.

Functions

func CommitFileAndGetHash

func CommitFileAndGetHash(t *testing.T, repoPath, filename, fileContent, commitMessage string) string

CommitFileAndGetHash wrapper around git add and git commit, returns the hash of commit.

func CreateKaeterModule

func CreateKaeterModule(t *testing.T, testFolder string, module *KaeterModuleConfig) (moduleFolder, commitHash string)

CreateKaeterModule is a test helper to initialize a mock kaeter module in an existing folder a KaeterModuleConfig config is used to decide how and which files to initialize

func CreateKaeterRepo

func CreateKaeterRepo(t *testing.T, module *KaeterModuleConfig) (repoMockPath, keaterModuleCommitHash string)

CreateKaeterRepo is a test helper to create a mock kaeter module in a tmp fodler it returns the path to the tmp folder. Caller is responsible for deleting it.

func CreateMockFile

func CreateMockFile(t *testing.T, tmpPath, filename, content string)

CreateMockFile creates file with content in a tmp folder

func CreateMockFolder

func CreateMockFolder(t *testing.T, tmpPath, folderPath string) string

CreateMockFolder mock folder or folder structure in a given tmp folder returns the absolute path of created folder

func CreateMockRepo

func CreateMockRepo(t *testing.T) (folder, commitHash string)

CreateMockRepo initializes a mock git repository in a tmp folder Note that it will also reset viper set the repoRoot key to the test folder as a convenience

func CreateTmpFolder

func CreateTmpFolder(t *testing.T) string

CreateTmpFolder returns path to new temp folder for testing

func GetEmptyVersionsYaml

func GetEmptyVersionsYaml(t *testing.T, moduleID string) string

GetEmptyVersionsYaml generates a new empty versions yaml with the given moduleID useful to create multiple modules without having duplicate ids.

func SwitchToNewBranch

func SwitchToNewBranch(t *testing.T, repoPath, branchName string)

SwitchToNewBranch wrapper around git switch -c branchName

Types

type KaeterModuleConfig

type KaeterModuleConfig struct {
	Path                    string // Sub folder of module relative to root folder, if empty module is created at root
	CHANGELOG               string
	CHANGELOGCreateEmpty    bool   // If true create empty file, otherwise when VersionsYAML is "" file wont be created
	CHANGELOGName           string // Handy to create a CHANGELOG.md or CHANGE or something.spec changelog (default CHANGELOG.md)
	Makefile                string
	MakefileCreateEmpty     bool
	MakefileDotKaeter       bool   // Create a Makefile.kaeter or plain Makefile
	OverrideCommitMessage   string // If not empty use this as commit message when adding files
	README                  string
	READMECreateEmpty       bool
	VersionsYAML            string
	VersionsYAMLCreateEmpty bool
}

KaeterModuleConfig configures how to create a kaeter mock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL