@@ -32,8 +32,8 @@ func TestCTagsRunner(t *testing.T) {
3232 defer cleanUpBuilderTestContext (t , ctx )
3333 ctx .Verbose = true
3434
35- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
3635 var _err error
36+ var ctagsOutput []byte
3737 commands := []types.Command {
3838 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
3939 types .BareCommand (func (ctx * types.Context ) error {
@@ -43,7 +43,10 @@ func TestCTagsRunner(t *testing.T) {
4343 & builder.ContainerFindIncludes {},
4444 & builder.PrintUsedLibrariesIfVerbose {},
4545 & 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+ }),
4750 }
4851 for _ , command := range commands {
4952 err := command .Run (ctx )
@@ -58,7 +61,7 @@ func TestCTagsRunner(t *testing.T) {
5861 "digitalCommand " + quotedSketchLocation + " /^void digitalCommand(BridgeClient client) {$/;\" kind:function line:82 signature:(BridgeClient client) returntype:void\n " +
5962 "analogCommand " + quotedSketchLocation + " /^void analogCommand(BridgeClient client) {$/;\" kind:function line:109 signature:(BridgeClient client) returntype:void\n " +
6063 "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 ))
6265}
6366
6467func TestCTagsRunnerSketchWithClass (t * testing.T ) {
@@ -67,8 +70,8 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
6770 defer cleanUpBuilderTestContext (t , ctx )
6871 ctx .Verbose = true
6972
70- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
7173 var _err error
74+ var ctagsOutput []byte
7275 commands := []types.Command {
7376 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
7477 types .BareCommand (func (ctx * types.Context ) error {
@@ -78,7 +81,10 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
7881 & builder.ContainerFindIncludes {},
7982 & builder.PrintUsedLibrariesIfVerbose {},
8083 & 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+ }),
8288 }
8389 for _ , command := range commands {
8490 err := command .Run (ctx )
@@ -91,7 +97,7 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
9197 "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 " +
9298 "setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:13\t signature:()\t returntype:void\n " +
9399 "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 ))
95101}
96102
97103func TestCTagsRunnerSketchWithTypename (t * testing.T ) {
@@ -100,8 +106,8 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
100106 defer cleanUpBuilderTestContext (t , ctx )
101107 ctx .Verbose = true
102108
103- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
104109 var _err error
110+ var ctagsOutput []byte
105111 commands := []types.Command {
106112 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
107113 types .BareCommand (func (ctx * types.Context ) error {
@@ -111,7 +117,10 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
111117 & builder.ContainerFindIncludes {},
112118 & builder.PrintUsedLibrariesIfVerbose {},
113119 & 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+ }),
115124 }
116125 for _ , command := range commands {
117126 err := command .Run (ctx )
@@ -123,7 +132,7 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
123132 "setup\t " + quotedSketchLocation + "\t /^void setup() {$/;\" \t kind:function\t line:6\t signature:()\t returntype:void\n " +
124133 "loop\t " + quotedSketchLocation + "\t /^void loop() {}$/;\" \t kind:function\t line:10\t signature:()\t returntype:void\n " +
125134 "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 ))
127136}
128137
129138func TestCTagsRunnerSketchWithNamespace (t * testing.T ) {
@@ -132,8 +141,8 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
132141 defer cleanUpBuilderTestContext (t , ctx )
133142 ctx .Verbose = true
134143
135- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
136144 var _err error
145+ var ctagsOutput []byte
137146 commands := []types.Command {
138147 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
139148 types .BareCommand (func (ctx * types.Context ) error {
@@ -143,7 +152,10 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
143152 & builder.ContainerFindIncludes {},
144153 & builder.PrintUsedLibrariesIfVerbose {},
145154 & 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+ }),
147159 }
148160 for _ , command := range commands {
149161 err := command .Run (ctx )
@@ -154,7 +166,7 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
154166 expectedOutput := "value\t " + quotedSketchLocation + "\t /^\t int value() {$/;\" \t kind:function\t line:2\t namespace:Test\t signature:()\t returntype:int\n " +
155167 "setup\t " + quotedSketchLocation + "\t /^void setup() {}$/;\" \t kind:function\t line:7\t signature:()\t returntype:void\n " +
156168 "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 ))
158170}
159171
160172func TestCTagsRunnerSketchWithTemplates (t * testing.T ) {
@@ -163,8 +175,8 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
163175 defer cleanUpBuilderTestContext (t , ctx )
164176 ctx .Verbose = true
165177
166- ctagsRunner := & builder.CTagsRunner {Source : & ctx .SketchSourceMerged , TargetFileName : "ctags_target.cpp" }
167178 var _err error
179+ var ctagsOutput []byte
168180 commands := []types.Command {
169181 & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
170182 types .BareCommand (func (ctx * types.Context ) error {
@@ -174,7 +186,10 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
174186 & builder.ContainerFindIncludes {},
175187 & builder.PrintUsedLibrariesIfVerbose {},
176188 & 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+ }),
178193 }
179194 for _ , command := range commands {
180195 err := command .Run (ctx )
@@ -186,5 +201,5 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
186201 "bVar\t " + quotedSketchLocation + "\t /^c< 8 > bVar;$/;\" \t kind:variable\t line:15\n " +
187202 "aVar\t " + quotedSketchLocation + "\t /^c< 1<<8 > aVar;$/;\" \t kind:variable\t line:16\n " +
188203 "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 ))
190205}
0 commit comments