Skip to content

Commit 2f2e2a6

Browse files
committed
Add back removed legacy test
1 parent d6d1653 commit 2f2e2a6

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

legacy/builder/test/ctags_runner_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,50 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
216216

217217
require.Equal(t, expectedOutput, strings.Replace(ctx.CTagsOutput, "\r\n", "\n", -1))
218218
}
219+
220+
func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
221+
DownloadCoresAndToolsAndLibraries(t)
222+
223+
sketchLocation := Abs(t, paths.New("sketch_with_templates_and_shift", "sketch_with_templates_and_shift.ino"))
224+
225+
ctx := &types.Context{
226+
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
227+
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
228+
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
229+
OtherLibrariesDirs: paths.NewPathList("libraries"),
230+
SketchLocation: sketchLocation,
231+
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
232+
ArduinoAPIVersion: "10600",
233+
Verbose: true,
234+
}
235+
236+
buildPath := SetupBuildPath(t, ctx)
237+
defer buildPath.RemoveAll()
238+
239+
commands := []types.Command{
240+
241+
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
242+
243+
&builder.ContainerMergeCopySketchFiles{},
244+
245+
&builder.ContainerFindIncludes{},
246+
247+
&builder.PrintUsedLibrariesIfVerbose{},
248+
&builder.WarnAboutArchIncompatibleLibraries{},
249+
&builder.CTagsTargetFileSaver{Source: &ctx.Source, TargetFileName: "ctags_target.cpp"},
250+
&builder.CTagsRunner{},
251+
}
252+
253+
for _, command := range commands {
254+
err := command.Run(ctx)
255+
NoError(t, err)
256+
}
257+
258+
quotedSketchLocation := strings.Replace(sketchLocation.String(), "\\", "\\\\", -1)
259+
expectedOutput := "printGyro\t" + quotedSketchLocation + "\t/^void printGyro()$/;\"\tkind:function\tline:10\tsignature:()\treturntype:void\n" +
260+
"bVar\t" + quotedSketchLocation + "\t/^c< 8 > bVar;$/;\"\tkind:variable\tline:15\n" +
261+
"aVar\t" + quotedSketchLocation + "\t/^c< 1<<8 > aVar;$/;\"\tkind:variable\tline:16\n" +
262+
"func\t" + quotedSketchLocation + "\t/^template<int X> func( c< 1<<X> & aParam) {$/;\"\tkind:function\tline:18\tsignature:( c< 1<<X> & aParam)\treturntype:template\n"
263+
264+
require.Equal(t, expectedOutput, strings.Replace(ctx.CTagsOutput, "\r\n", "\n", -1))
265+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
template<> class FastPin<0> : public _ARMPIN<0, 10, 1 << 10, 0> {};;
2+
3+
template<> class FastPin<0> : public _ARMPIN<0, 10, 1 < 10, 0> {};;
4+
5+
template <class SomeType, template <class> class OtherType> class NestedTemplateClass
6+
{
7+
OtherType<SomeType> f;
8+
};
9+
10+
void printGyro()
11+
{
12+
}
13+
14+
template <int P> class c {};
15+
c< 8 > bVar;
16+
c< 1<<8 > aVar;
17+
18+
template<int X> func( c< 1<<X> & aParam) {
19+
}

0 commit comments

Comments
 (0)