refactor: implement mocking functions and tests

This commit is contained in:
Patryk Hegenberg 2025-01-15 21:39:17 +01:00
parent 339dba4e13
commit f8ef2ef2d5
21 changed files with 398 additions and 90 deletions

View file

@ -19,7 +19,7 @@ import (
func Build() error {
mg.Deps(InstallDeps)
fmt.Println("Building...")
cmd := exec.Command("go", "build", "-o", "MyApp", ".")
cmd := exec.Command("go", "build", "-o", "system_setup_tool", ".")
return cmd.Run()
}
@ -27,7 +27,7 @@ func Build() error {
func Install() error {
mg.Deps(Build)
fmt.Println("Installing...")
return os.Rename("./MyApp", "/usr/bin/MyApp")
return os.Rename("./system_setup_tool", "/usr/bin/system_setup_tool")
}
// Manage your deps, or running package managers.
@ -56,3 +56,10 @@ func Lint() error {
cmd := exec.Command("golangci-lint", "./...")
return cmd.Run()
}
// perform all modul tests
func Test() error {
fmt.Println("Testing...")
cmd := exec.Command("go", "test", "./...")
return cmd.Run()
}