@@ -32,8 +32,8 @@ func TestCTagsRunner(t *testing.T) {
32
32
defer cleanUpBuilderTestContext (t , ctx )
33
33
ctx .Verbose = true
34
34
35
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
36
35
var _err error
36
+ var ctagsOutput []byte
37
37
commands := []types.Command {
38
38
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
39
39
types .BareCommand (func (ctx * types.Context ) error {
@@ -43,7 +43,10 @@ func TestCTagsRunner(t *testing.T) {
43
43
& builder.ContainerFindIncludes {},
44
44
& builder.PrintUsedLibrariesIfVerbose {},
45
45
& builder.WarnAboutArchIncompatibleLibraries {},
46
- ctagsRunner ,
46
+ types .BareCommand (func (ctx * types.Context ) error {
47
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
48
+ return _err
49
+ }),
47
50
}
48
51
for _ , command := range commands {
49
52
err := command .Run (ctx )
@@ -58,7 +61,7 @@ func TestCTagsRunner(t *testing.T) {
58
61
"digitalCommand " + quotedSketchLocation + " /^void digitalCommand(BridgeClient client) {$/;\" kind:function line:82 signature:(BridgeClient client) returntype:void\n " +
59
62
"analogCommand " + quotedSketchLocation + " /^void analogCommand(BridgeClient client) {$/;\" kind:function line:109 signature:(BridgeClient client) returntype:void\n " +
60
63
"modeCommand " + quotedSketchLocation + " /^void modeCommand(BridgeClient client) {$/;\" kind:function line:149 signature:(BridgeClient client) returntype:void\n "
61
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
64
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
62
65
}
63
66
64
67
func TestCTagsRunnerSketchWithClass (t * testing.T ) {
@@ -67,8 +70,8 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
67
70
defer cleanUpBuilderTestContext (t , ctx )
68
71
ctx .Verbose = true
69
72
70
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
71
73
var _err error
74
+ var ctagsOutput []byte
72
75
commands := []types.Command {
73
76
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
74
77
types .BareCommand (func (ctx * types.Context ) error {
@@ -78,7 +81,10 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
78
81
& builder.ContainerFindIncludes {},
79
82
& builder.PrintUsedLibrariesIfVerbose {},
80
83
& builder.WarnAboutArchIncompatibleLibraries {},
81
- ctagsRunner ,
84
+ types .BareCommand (func (ctx * types.Context ) error {
85
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
86
+ return _err
87
+ }),
82
88
}
83
89
for _ , command := range commands {
84
90
err := command .Run (ctx )
@@ -91,7 +97,7 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
91
97
"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 " +
92
98
"setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:13\t signature:()\t returntype:void\n " +
93
99
"loop\t " + quotedSketchLocation + "\t /^void loop() {$/;\" \t kind:function\t line:17\t signature:()\t returntype:void\n "
94
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
100
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
95
101
}
96
102
97
103
func TestCTagsRunnerSketchWithTypename (t * testing.T ) {
@@ -100,8 +106,8 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
100
106
defer cleanUpBuilderTestContext (t , ctx )
101
107
ctx .Verbose = true
102
108
103
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
104
109
var _err error
110
+ var ctagsOutput []byte
105
111
commands := []types.Command {
106
112
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
107
113
types .BareCommand (func (ctx * types.Context ) error {
@@ -111,7 +117,10 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
111
117
& builder.ContainerFindIncludes {},
112
118
& builder.PrintUsedLibrariesIfVerbose {},
113
119
& builder.WarnAboutArchIncompatibleLibraries {},
114
- ctagsRunner ,
120
+ types .BareCommand (func (ctx * types.Context ) error {
121
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
122
+ return _err
123
+ }),
115
124
}
116
125
for _ , command := range commands {
117
126
err := command .Run (ctx )
@@ -123,7 +132,7 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
123
132
"setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:6\t signature:()\t returntype:void\n " +
124
133
"loop\t " + quotedSketchLocation + "\t /^void loop() {}$/;\" \t kind:function\t line:10\t signature:()\t returntype:void\n " +
125
134
"func\t " + quotedSketchLocation + "\t /^typename Foo<char>::Bar func(){$/;\" \t kind:function\t line:12\t signature:()\t returntype:Foo::Bar\n "
126
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
135
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
127
136
}
128
137
129
138
func TestCTagsRunnerSketchWithNamespace (t * testing.T ) {
@@ -132,8 +141,8 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
132
141
defer cleanUpBuilderTestContext (t , ctx )
133
142
ctx .Verbose = true
134
143
135
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
136
144
var _err error
145
+ var ctagsOutput []byte
137
146
commands := []types.Command {
138
147
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
139
148
types .BareCommand (func (ctx * types.Context ) error {
@@ -143,7 +152,10 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
143
152
& builder.ContainerFindIncludes {},
144
153
& builder.PrintUsedLibrariesIfVerbose {},
145
154
& builder.WarnAboutArchIncompatibleLibraries {},
146
- ctagsRunner ,
155
+ types .BareCommand (func (ctx * types.Context ) error {
156
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
157
+ return _err
158
+ }),
147
159
}
148
160
for _ , command := range commands {
149
161
err := command .Run (ctx )
@@ -154,7 +166,7 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
154
166
expectedOutput := "value\t " + quotedSketchLocation + "\t /^\t int value() {$/;\" \t kind:function\t line:2\t namespace:Test\t signature:()\t returntype:int\n " +
155
167
"setup\t " + quotedSketchLocation + "\t /^void setup() {}$/;\" \t kind:function\t line:7\t signature:()\t returntype:void\n " +
156
168
"loop\t " + quotedSketchLocation + "\t /^void loop() {}$/;\" \t kind:function\t line:8\t signature:()\t returntype:void\n "
157
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
169
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
158
170
}
159
171
160
172
func TestCTagsRunnerSketchWithTemplates (t * testing.T ) {
@@ -163,8 +175,8 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
163
175
defer cleanUpBuilderTestContext (t , ctx )
164
176
ctx .Verbose = true
165
177
166
- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
167
178
var _err error
179
+ var ctagsOutput []byte
168
180
commands := []types.Command {
169
181
& builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
170
182
types .BareCommand (func (ctx * types.Context ) error {
@@ -174,7 +186,10 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
174
186
& builder.ContainerFindIncludes {},
175
187
& builder.PrintUsedLibrariesIfVerbose {},
176
188
& builder.WarnAboutArchIncompatibleLibraries {},
177
- ctagsRunner ,
189
+ types .BareCommand (func (ctx * types.Context ) error {
190
+ ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
191
+ return _err
192
+ }),
178
193
}
179
194
for _ , command := range commands {
180
195
err := command .Run (ctx )
@@ -186,5 +201,5 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
186
201
"bVar\t " + quotedSketchLocation + "\t /^c< 8 > bVar;$/;\" \t kind:variable\t line:15\n " +
187
202
"aVar\t " + quotedSketchLocation + "\t /^c< 1<<8 > aVar;$/;\" \t kind:variable\t line:16\n " +
188
203
"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 "
189
- require .Equal (t , expectedOutput , strings .Replace (string (ctagsRunner . CtagsOutput ), "\r \n " , "\n " , - 1 ))
204
+ require .Equal (t , expectedOutput , strings .Replace (string (ctagsOutput ), "\r \n " , "\n " , - 1 ))
190
205
}
0 commit comments