MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestCeler_Init_NewConfig

Function TestCeler_Init_NewConfig

configs/celer_test.go:12–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestCeler_Init_NewConfig(t *testing.T) {
13 tmpDir := t.TempDir()
14 dirs.Init(tmpDir)
15 celerPath := filepath.Join(tmpDir, "celer.toml")
16
17 if fileio.PathExists(celerPath) {
18 t.Fatalf("celer.toml should not exist initially")
19 }
20
21 // Test init.
22 celer := NewCeler()
23 if err := celer.Init(); err != nil {
24 t.Errorf("Init() error = %v", err)
25 }
26
27 // Test cases.
28 if !fileio.PathExists(celerPath) {
29 t.Error("celer.toml should be created")
30 }
31 if buildType := celer.BuildType(); buildType != "release" {
32 t.Errorf("BuildType() = %v, want release", buildType)
33 }
34 if jobs := celer.Jobs(); jobs <= 0 {
35 t.Errorf("Jobs() = %v, want positive number", jobs)
36 }
37}
38
39func TestCeler_Init_ExistingConfig(t *testing.T) {
40 // Prepare test environment.

Callers

nothing calls this directly

Calls 7

InitMethod · 0.95
BuildTypeMethod · 0.95
JobsMethod · 0.95
InitFunction · 0.92
PathExistsFunction · 0.92
NewCelerFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected