mocks

package
v0.0.0-...-4d54ae9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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 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

Variables

This section is empty.

Functions

func AddSubDirKaeterMock

func AddSubDirKaeterMock(t *testing.T, testFolder, modulePath, versionsYAML string) (moduleFolder, commitHash string)

AddSubDirKaeterMock 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 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 CreateMockFile

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

CreateMockFile creates file with content in a tmp folder

func CreateMockKaeterRepo

func CreateMockKaeterRepo(t *testing.T, makefileContent, commitMessage, versionsYAML string) string

CreateMockKaeterRepo 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 CreateMockRepo

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

CreateMockRepo initializes a mock git repository in a tmp folder

func CreateTmpFolder

func CreateTmpFolder(t *testing.T) string

CreateTmpFolder returns path to new temp folder for testing

func SwitchToNewBranch

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

SwitchToNewBranch wrapper around git switch -c branchName

Types

This section is empty.

Jump to

Keyboard shortcuts

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