@@ -10,9 +10,11 @@ import (
1010 "os"
1111 "path/filepath"
1212 "testing"
13+
14+ "github.com/ActiveMemory/ctx/internal/cli/dep/core/builder"
1315)
1416
15- func TestDetectBuilder (t * testing.T ) {
17+ func TestDetect (t * testing.T ) {
1618 orig , getErr := os .Getwd ()
1719 if getErr != nil {
1820 t .Fatal (getErr )
@@ -24,9 +26,9 @@ func TestDetectBuilder(t *testing.T) {
2426 if chdirErr := os .Chdir (tmp ); chdirErr != nil {
2527 t .Fatal (chdirErr )
2628 }
27- if b := DetectBuilder (); b != nil {
29+ if b := builder . Detect (); b != nil {
2830 t .Errorf (
29- "DetectBuilder () = %q in empty dir, want nil" ,
31+ "Detect () = %q in empty dir, want nil" ,
3032 b .Name (),
3133 )
3234 }
@@ -39,16 +41,16 @@ func TestDetectBuilder(t *testing.T) {
3941 if writeErr != nil {
4042 t .Fatal (writeErr )
4143 }
42- if b := DetectBuilder (); b == nil ||
44+ if b := builder . Detect (); b == nil ||
4345 b .Name () != "go" {
4446 t .Errorf (
45- "DetectBuilder () with go.mod: want 'go', got %v" ,
47+ "Detect () with go.mod: want 'go', got %v" ,
4648 b ,
4749 )
4850 }
4951}
5052
51- func TestDetectBuilder_Node (t * testing.T ) {
53+ func TestDetect_Node (t * testing.T ) {
5254 orig , getErr := os .Getwd ()
5355 if getErr != nil {
5456 t .Fatal (getErr )
@@ -67,16 +69,16 @@ func TestDetectBuilder_Node(t *testing.T) {
6769 if writeErr != nil {
6870 t .Fatal (writeErr )
6971 }
70- if b := DetectBuilder (); b == nil ||
72+ if b := builder . Detect (); b == nil ||
7173 b .Name () != "node" {
7274 t .Errorf (
73- "DetectBuilder () with package.json: want 'node', got %v" ,
75+ "Detect () with package.json: want 'node', got %v" ,
7476 b ,
7577 )
7678 }
7779}
7880
79- func TestDetectBuilder_Python (t * testing.T ) {
81+ func TestDetect_Python (t * testing.T ) {
8082 orig , getErr := os .Getwd ()
8183 if getErr != nil {
8284 t .Fatal (getErr )
@@ -95,16 +97,16 @@ func TestDetectBuilder_Python(t *testing.T) {
9597 if writeErr != nil {
9698 t .Fatal (writeErr )
9799 }
98- if b := DetectBuilder (); b == nil ||
100+ if b := builder . Detect (); b == nil ||
99101 b .Name () != "python" {
100102 t .Errorf (
101- "DetectBuilder () with requirements.txt: want 'python', got %v" ,
103+ "Detect () with requirements.txt: want 'python', got %v" ,
102104 b ,
103105 )
104106 }
105107}
106108
107- func TestDetectBuilder_Rust (t * testing.T ) {
109+ func TestDetect_Rust (t * testing.T ) {
108110 orig , getErr := os .Getwd ()
109111 if getErr != nil {
110112 t .Fatal (getErr )
@@ -124,16 +126,16 @@ func TestDetectBuilder_Rust(t *testing.T) {
124126 if writeErr != nil {
125127 t .Fatal (writeErr )
126128 }
127- if b := DetectBuilder (); b == nil ||
129+ if b := builder . Detect (); b == nil ||
128130 b .Name () != "rust" {
129131 t .Errorf (
130- "DetectBuilder () with Cargo.toml: want 'rust', got %v" ,
132+ "Detect () with Cargo.toml: want 'rust', got %v" ,
131133 b ,
132134 )
133135 }
134136}
135137
136- func TestDetectBuilder_PriorityOrder (t * testing.T ) {
138+ func TestDetect_PriorityOrder (t * testing.T ) {
137139 orig , getErr := os .Getwd ()
138140 if getErr != nil {
139141 t .Fatal (getErr )
@@ -160,37 +162,37 @@ func TestDetectBuilder_PriorityOrder(t *testing.T) {
160162 t .Fatal (writeErr )
161163 }
162164
163- if b := DetectBuilder (); b == nil ||
165+ if b := builder . Detect (); b == nil ||
164166 b .Name () != "go" {
165167 t .Errorf (
166- "DetectBuilder () with go.mod+package.json: want 'go', got %v" ,
168+ "Detect () with go.mod+package.json: want 'go', got %v" ,
167169 b ,
168170 )
169171 }
170172}
171173
172- func TestFindBuilder (t * testing.T ) {
174+ func TestFind (t * testing.T ) {
173175 for _ , name := range []string {
174176 "go" , "node" , "python" , "rust" ,
175177 } {
176- if b := FindBuilder (name ); b == nil {
178+ if b := builder . Find (name ); b == nil {
177179 t .Errorf (
178- "FindBuilder (%q) = nil, want builder" , name ,
180+ "Find (%q) = nil, want builder" , name ,
179181 )
180182 }
181183 }
182- if b := FindBuilder ("java" ); b != nil {
184+ if b := builder . Find ("java" ); b != nil {
183185 t .Errorf (
184- "FindBuilder ('java') = %v, want nil" , b ,
186+ "Find ('java') = %v, want nil" , b ,
185187 )
186188 }
187189}
188190
189- func TestBuilderNames (t * testing.T ) {
190- names := BuilderNames ()
191+ func TestNames (t * testing.T ) {
192+ names := builder . Names ()
191193 if len (names ) != 4 {
192194 t .Fatalf (
193- "BuilderNames () returned %d names, want 4" ,
195+ "Names () returned %d names, want 4" ,
194196 len (names ),
195197 )
196198 }
@@ -200,7 +202,7 @@ func TestBuilderNames(t *testing.T) {
200202 for i , want := range expected {
201203 if names [i ] != want {
202204 t .Errorf (
203- "BuilderNames ()[%d] = %q, want %q" ,
205+ "Names ()[%d] = %q, want %q" ,
204206 i , names [i ], want ,
205207 )
206208 }
0 commit comments