MCPcopy Index your code
hub / github.com/celer-pkg/celer / installForTestRemove

Function installForTestRemove

cmds/cmd_remove_test.go:539–589  ·  view source on GitHub ↗
(t *testing.T, nameVersion string, option configs.RemoveOptions)

Source from the content-addressed store, hash-verified

537}
538
539func installForTestRemove(t *testing.T, nameVersion string, option configs.RemoveOptions) configs.Port {
540 // Check error.
541 var check = func(err error) {
542 t.Helper()
543 if err != nil {
544 t.Fatal(err)
545 }
546 }
547
548 // Cleanup workspace.
549 dirs.RemoveAllForTest()
550
551 var (
552 windowsPlatform = expr.If(os.Getenv("GITHUB_ACTIONS") == "true", "x86_64-windows-msvc-enterprise-14", "x86_64-windows-msvc-community-14")
553 platform = expr.If(runtime.GOOS == "windows", windowsPlatform, "x86_64-linux-ubuntu-22.04-gcc-11.5.0")
554 project = "project_test_remove"
555 )
556
557 // Init celer.
558 celer := configs.NewCeler()
559 check(celer.Init())
560 check(celer.CloneConf(test_conf_repo_url, test_conf_repo_branch, true))
561 check(celer.SetBuildType("Release"))
562 check(celer.SetPlatform(platform))
563 check(celer.SetProject(project))
564
565 var (
566 packageFolder = filepath.Join(platform, project, celer.BuildType(), nameVersion)
567 port configs.Port
568 options configs.InstallOptions
569 )
570
571 check(port.Init(celer, nameVersion))
572 check(port.InstallFromSource(options))
573
574 // Check if package dir exists.
575 packageDir := filepath.Join(dirs.PackagesDir, packageFolder)
576 if !fileio.PathExists(packageDir) {
577 t.Fatalf("package dir cannot found : %s", packageDir)
578 }
579
580 // Check if installed.
581 installed, err := port.Installed()
582 check(err)
583 if !installed {
584 t.Fatal("package is not installed")
585 }
586
587 check(port.Remove(option))
588 return port
589}

Callers 4

TestRemoveCmd_DefaultFunction · 0.85
TestRemoveCmd_BuildCacheFunction · 0.85
TestRemoveCmd_PurgeFunction · 0.85
TestRemoveCmd_RecursiveFunction · 0.85

Calls 15

InitMethod · 0.95
CloneConfMethod · 0.95
SetBuildTypeMethod · 0.95
SetPlatformMethod · 0.95
SetProjectMethod · 0.95
BuildTypeMethod · 0.95
RemoveAllForTestFunction · 0.92
IfFunction · 0.92
NewCelerFunction · 0.92
PathExistsFunction · 0.92
checkFunction · 0.85
InstallFromSourceMethod · 0.80

Tested by

no test coverage detected