@@ -45,8 +45,8 @@ func TestCTagsRunner(t *testing.T) {
45
45
buildPath := SetupBuildPath (t , ctx )
46
46
defer buildPath .RemoveAll ()
47
47
48
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
49
48
var _err error
49
+ var ctagsOutput []byte
50
50
commands := []types.Command {
51
51
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
52
52
types .BareCommand (func (ctx * types.Context ) error {
@@ -56,7 +56,10 @@ func TestCTagsRunner(t *testing.T) {
56
56
& builder.ContainerFindIncludes {},
57
57
& builder.PrintUsedLibrariesIfVerbose {},
58
58
& builder.WarnAboutArchIncompatibleLibraries {},
59
- ctagsRunner ,
59
+ types .BareCommand (func (ctx * types.Context ) error {
60
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
61
+ return _err
62
+ }),
60
63
}
61
64
for _ , command := range commands {
62
65
err := command .Run (ctx )
@@ -71,7 +74,7 @@ func TestCTagsRunner(t *testing.T) {
71
74
"digitalCommand " + quotedSketchLocation + " /^void digitalCommand(BridgeClient client) {$/;\" kind:function line:82 signature:(BridgeClient client) returntype:void\n " +
72
75
"analogCommand " + quotedSketchLocation + " /^void analogCommand(BridgeClient client) {$/;\" kind:function line:109 signature:(BridgeClient client) returntype:void\n " +
73
76
"modeCommand " + quotedSketchLocation + " /^void modeCommand(BridgeClient client) {$/;\" kind:function line:149 signature:(BridgeClient client) returntype:void\n "
74
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
77
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
75
78
}
76
79
77
80
func TestCTagsRunnerSketchWithClass (t * testing.T ) {
@@ -92,8 +95,8 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
92
95
buildPath := SetupBuildPath (t , ctx )
93
96
defer buildPath .RemoveAll ()
94
97
95
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
96
98
var _err error
99
+ var ctagsOutput []byte
97
100
commands := []types.Command {
98
101
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
99
102
types .BareCommand (func (ctx * types.Context ) error {
@@ -103,7 +106,10 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
103
106
& builder.ContainerFindIncludes {},
104
107
& builder.PrintUsedLibrariesIfVerbose {},
105
108
& builder.WarnAboutArchIncompatibleLibraries {},
106
- ctagsRunner ,
109
+ types .BareCommand (func (ctx * types.Context ) error {
110
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
111
+ return _err
112
+ }),
107
113
}
108
114
for _ , command := range commands {
109
115
err := command .Run (ctx )
@@ -116,7 +122,7 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
116
122
"set_values\t " + quotedSketchLocation + "\t /^void Rectangle::set_values (int x, int y) {$/;\" \t kind:function\t line:8\t class:Rectangle\t signature:(int x, int y)\t returntype:void\n " +
117
123
"setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:13\t signature:()\t returntype:void\n " +
118
124
"loop\t " + quotedSketchLocation + "\t /^void loop() {$/;\" \t kind:function\t line:17\t signature:()\t returntype:void\n "
119
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
125
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
120
126
}
121
127
122
128
func TestCTagsRunnerSketchWithTypename (t * testing.T ) {
@@ -137,8 +143,8 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
137
143
buildPath := SetupBuildPath (t , ctx )
138
144
defer buildPath .RemoveAll ()
139
145
140
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
141
146
var _err error
147
+ var ctagsOutput []byte
142
148
commands := []types.Command {
143
149
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
144
150
types .BareCommand (func (ctx * types.Context ) error {
@@ -148,7 +154,10 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
148
154
& builder.ContainerFindIncludes {},
149
155
& builder.PrintUsedLibrariesIfVerbose {},
150
156
& builder.WarnAboutArchIncompatibleLibraries {},
151
- ctagsRunner ,
157
+ types .BareCommand (func (ctx * types.Context ) error {
158
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
159
+ return _err
160
+ }),
152
161
}
153
162
for _ , command := range commands {
154
163
err := command .Run (ctx )
@@ -160,7 +169,7 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
160
169
"setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:6\t signature:()\t returntype:void\n " +
161
170
"loop\t " + quotedSketchLocation + "\t /^void loop() {}$/;\" \t kind:function\t line:10\t signature:()\t returntype:void\n " +
162
171
"func\t " + quotedSketchLocation + "\t /^typename Foo<char>::Bar func(){$/;\" \t kind:function\t line:12\t signature:()\t returntype:Foo::Bar\n "
163
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
172
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
164
173
}
165
174
166
175
func TestCTagsRunnerSketchWithNamespace (t * testing.T ) {
@@ -181,8 +190,8 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
181
190
buildPath := SetupBuildPath (t , ctx )
182
191
defer buildPath .RemoveAll ()
183
192
184
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
185
193
var _err error
194
+ var ctagsOutput []byte
186
195
commands := []types.Command {
187
196
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
188
197
types .BareCommand (func (ctx * types.Context ) error {
@@ -192,7 +201,10 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
192
201
& builder.ContainerFindIncludes {},
193
202
& builder.PrintUsedLibrariesIfVerbose {},
194
203
& builder.WarnAboutArchIncompatibleLibraries {},
195
- ctagsRunner ,
204
+ types .BareCommand (func (ctx * types.Context ) error {
205
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
206
+ return _err
207
+ }),
196
208
}
197
209
for _ , command := range commands {
198
210
err := command .Run (ctx )
@@ -203,7 +215,7 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
203
215
expectedOutput := "value\t " + quotedSketchLocation + "\t /^\t int value() {$/;\" \t kind:function\t line:2\t namespace:Test\t signature:()\t returntype:int\n " +
204
216
"setup\t " + quotedSketchLocation + "\t /^void setup() {}$/;\" \t kind:function\t line:7\t signature:()\t returntype:void\n " +
205
217
"loop\t " + quotedSketchLocation + "\t /^void loop() {}$/;\" \t kind:function\t line:8\t signature:()\t returntype:void\n "
206
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
218
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
207
219
}
208
220
209
221
func TestCTagsRunnerSketchWithTemplates (t * testing.T ) {
@@ -224,8 +236,8 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
224
236
buildPath := SetupBuildPath (t , ctx )
225
237
defer buildPath .RemoveAll ()
226
238
227
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
228
239
var _err error
240
+ var ctagsOutput []byte
229
241
commands := []types.Command {
230
242
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
231
243
types .BareCommand (func (ctx * types.Context ) error {
@@ -235,7 +247,10 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
235
247
& builder.ContainerFindIncludes {},
236
248
& builder.PrintUsedLibrariesIfVerbose {},
237
249
& builder.WarnAboutArchIncompatibleLibraries {},
238
- ctagsRunner ,
250
+ types .BareCommand (func (ctx * types.Context ) error {
251
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
252
+ return _err
253
+ }),
239
254
}
240
255
for _ , command := range commands {
241
256
err := command .Run (ctx )
@@ -247,5 +262,5 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
247
262
"bVar\t " + quotedSketchLocation + "\t /^c< 8 > bVar;$/;\" \t kind:variable\t line:15\n " +
248
263
"aVar\t " + quotedSketchLocation + "\t /^c< 1<<8 > aVar;$/;\" \t kind:variable\t line:16\n " +
249
264
"func\t " + quotedSketchLocation + "\t /^template<int X> func( c< 1<<X> & aParam) {$/;\" \t kind:function\t line:18\t signature:( c< 1<<X> & aParam)\t returntype:template\n "
250
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
265
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
251
266
}
0 commit comments