@@ -32,23 +32,12 @@ func TestCTagsRunner(t *testing.T) {
32
32
defer cleanUpBuilderTestContext (t , ctx )
33
33
ctx .Verbose = true
34
34
35
- var _err error
36
- var ctagsOutput []byte
37
- commands := []types.Command {
38
- & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
39
- types .BareCommand (func (ctx * types.Context ) error {
40
- ctx .LineOffset , ctx .SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
41
- return _err
42
- }),
43
- types .BareCommand (func (ctx * types.Context ) error {
44
- ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
45
- return _err
46
- }),
47
- }
48
- for _ , command := range commands {
49
- err := command .Run (ctx )
50
- NoError (t , err )
51
- }
35
+ err := (& builder.ContainerSetupHardwareToolsLibsSketchAndProps {}).Run (ctx )
36
+ NoError (t , err )
37
+ _ , source , err := bldr .PrepareSketchBuildPath (ctx .Sketch , nil , ctx .SketchBuildPath )
38
+ NoError (t , err )
39
+ ctagsOutput , _ , _ , _ , err := builder .RunCTags (ctx .Sketch , source , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
40
+ NoError (t , err )
52
41
53
42
quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
54
43
expectedOutput := "server " + quotedSketchLocation + " /^BridgeServer server;$/;\" kind:variable line:31\n " +
@@ -67,23 +56,12 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
67
56
defer cleanUpBuilderTestContext (t , ctx )
68
57
ctx .Verbose = true
69
58
70
- var _err error
71
- var ctagsOutput []byte
72
- commands := []types.Command {
73
- & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
74
- types .BareCommand (func (ctx * types.Context ) error {
75
- ctx .LineOffset , ctx .SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
76
- return _err
77
- }),
78
- types .BareCommand (func (ctx * types.Context ) error {
79
- ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
80
- return _err
81
- }),
82
- }
83
- for _ , command := range commands {
84
- err := command .Run (ctx )
85
- NoError (t , err )
86
- }
59
+ err := (& builder.ContainerSetupHardwareToolsLibsSketchAndProps {}).Run (ctx )
60
+ NoError (t , err )
61
+ _ , source , err := bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
62
+ NoError (t , err )
63
+ ctagsOutput , _ , _ , _ , err := builder .RunCTags (ctx .Sketch , source , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
64
+ NoError (t , err )
87
65
88
66
quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
89
67
expectedOutput := "set_values\t " + quotedSketchLocation + "\t /^ void set_values (int,int);$/;\" \t kind:prototype\t line:4\t class:Rectangle\t signature:(int,int)\t returntype:void\n " +
@@ -100,23 +78,12 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
100
78
defer cleanUpBuilderTestContext (t , ctx )
101
79
ctx .Verbose = true
102
80
103
- var _err error
104
- var ctagsOutput []byte
105
- commands := []types.Command {
106
- & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
107
- types .BareCommand (func (ctx * types.Context ) error {
108
- ctx .LineOffset , ctx .SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
109
- return _err
110
- }),
111
- types .BareCommand (func (ctx * types.Context ) error {
112
- ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
113
- return _err
114
- }),
115
- }
116
- for _ , command := range commands {
117
- err := command .Run (ctx )
118
- NoError (t , err )
119
- }
81
+ err := (& builder.ContainerSetupHardwareToolsLibsSketchAndProps {}).Run (ctx )
82
+ NoError (t , err )
83
+ _ , source , err := bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
84
+ NoError (t , err )
85
+ ctagsOutput , _ , _ , _ , err := builder .RunCTags (ctx .Sketch , source , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
86
+ NoError (t , err )
120
87
121
88
quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
122
89
expectedOutput := "Foo\t " + quotedSketchLocation + "\t /^ struct Foo{$/;\" \t kind:struct\t line:2\n " +
@@ -132,23 +99,12 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
132
99
defer cleanUpBuilderTestContext (t , ctx )
133
100
ctx .Verbose = true
134
101
135
- var _err error
136
- var ctagsOutput []byte
137
- commands := []types.Command {
138
- & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
139
- types .BareCommand (func (ctx * types.Context ) error {
140
- ctx .LineOffset , ctx .SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
141
- return _err
142
- }),
143
- types .BareCommand (func (ctx * types.Context ) error {
144
- ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
145
- return _err
146
- }),
147
- }
148
- for _ , command := range commands {
149
- err := command .Run (ctx )
150
- NoError (t , err )
151
- }
102
+ err := (& builder.ContainerSetupHardwareToolsLibsSketchAndProps {}).Run (ctx )
103
+ NoError (t , err )
104
+ _ , source , err := bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
105
+ NoError (t , err )
106
+ ctagsOutput , _ , _ , _ , err := builder .RunCTags (ctx .Sketch , source , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
107
+ NoError (t , err )
152
108
153
109
quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
154
110
expectedOutput := "value\t " + quotedSketchLocation + "\t /^\t int value() {$/;\" \t kind:function\t line:2\t namespace:Test\t signature:()\t returntype:int\n " +
@@ -163,23 +119,12 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
163
119
defer cleanUpBuilderTestContext (t , ctx )
164
120
ctx .Verbose = true
165
121
166
- var _err error
167
- var ctagsOutput []byte
168
- commands := []types.Command {
169
- & builder.ContainerSetupHardwareToolsLibsSketchAndProps {},
170
- types .BareCommand (func (ctx * types.Context ) error {
171
- ctx .LineOffset , ctx .SketchSourceMerged , _err = bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
172
- return _err
173
- }),
174
- types .BareCommand (func (ctx * types.Context ) error {
175
- ctagsOutput , _ , _ , _ , _err = builder .RunCTags (ctx .Sketch , ctx .SketchSourceMerged , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
176
- return _err
177
- }),
178
- }
179
- for _ , command := range commands {
180
- err := command .Run (ctx )
181
- NoError (t , err )
182
- }
122
+ err := (& builder.ContainerSetupHardwareToolsLibsSketchAndProps {}).Run (ctx )
123
+ NoError (t , err )
124
+ _ , source , err := bldr .PrepareSketchBuildPath (ctx .Sketch , ctx .SourceOverride , ctx .SketchBuildPath )
125
+ NoError (t , err )
126
+ ctagsOutput , _ , _ , _ , err := builder .RunCTags (ctx .Sketch , source , "ctags_target.cpp" , ctx .BuildProperties , ctx .PreprocPath )
127
+ NoError (t , err )
183
128
184
129
quotedSketchLocation := strings .Replace (sketchLocation .String (), "\\ " , "\\ \\ " , - 1 )
185
130
expectedOutput := "printGyro\t " + quotedSketchLocation + "\t /^void printGyro()$/;\" \t kind:function\t line:10\t signature:()\t returntype:void\n " +
0 commit comments