-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefaults_test.go
More file actions
52 lines (48 loc) · 1.84 KB
/
defaults_test.go
File metadata and controls
52 lines (48 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package templar
import (
"testing"
)
// TestDefaultToolInfo verifies that DefaultToolInfo returns a fully populated
// ToolInfo with templar's standard naming conventions. This ensures the
// backward-compatible defaults are correct and no fields are accidentally empty.
func TestDefaultToolInfo(t *testing.T) {
info := DefaultToolInfo()
if info.Name != "templar" {
t.Errorf("Expected Name 'templar', got '%s'", info.Name)
}
if len(info.ConfigNames) != 2 {
t.Errorf("Expected 2 config names, got %d", len(info.ConfigNames))
}
if info.ConfigNames[0] != "templar.yaml" {
t.Errorf("Expected first config name 'templar.yaml', got '%s'", info.ConfigNames[0])
}
if info.ConfigNames[1] != ".templar.yaml" {
t.Errorf("Expected second config name '.templar.yaml', got '%s'", info.ConfigNames[1])
}
if info.VendorDir != "./templar_modules" {
t.Errorf("Expected VendorDir './templar_modules', got '%s'", info.VendorDir)
}
if info.LockFile != "templar.lock" {
t.Errorf("Expected LockFile 'templar.lock', got '%s'", info.LockFile)
}
if info.FetchCmd != "templar get" {
t.Errorf("Expected FetchCmd 'templar get', got '%s'", info.FetchCmd)
}
if info.ProjectURL == "" {
t.Error("Expected ProjectURL to be non-empty")
}
}
// TestDefaultConstants verifies that the exported constants match the expected
// templar default values. These constants are used by CLI code to reference
// default file names without reconstructing a full ToolInfo.
func TestDefaultConstants(t *testing.T) {
if DefaultVendorDir != "./templar_modules" {
t.Errorf("Expected DefaultVendorDir './templar_modules', got '%s'", DefaultVendorDir)
}
if DefaultLockFile != "templar.lock" {
t.Errorf("Expected DefaultLockFile 'templar.lock', got '%s'", DefaultLockFile)
}
if len(DefaultConfigNames) != 2 {
t.Errorf("Expected 2 DefaultConfigNames, got %d", len(DefaultConfigNames))
}
}