Skip to content

Commit 51d32d7

Browse files
author
Federico Fissore
committed
Updating ctags to 5.8-arduino2, ensuring it deals with "typename"
Signed-off-by: Federico Fissore <[email protected]>
1 parent dd686c1 commit 51d32d7

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

Diff for: src/arduino.cc/builder/test/ctags_runner_test.go

+45
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,48 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
133133

134134
require.Equal(t, expectedOutput, strings.Replace(context[constants.CTX_CTAGS_OUTPUT].(string), "\r\n", "\n", -1))
135135
}
136+
137+
func TestCTagsRunnerSketchWithTypename(t *testing.T) {
138+
DownloadCoresAndToolsAndLibraries(t)
139+
140+
context := make(map[string]interface{})
141+
142+
buildPath := SetupBuildPath(t, context)
143+
defer os.RemoveAll(buildPath)
144+
145+
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
146+
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
147+
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
148+
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_typename", "sketch.ino")
149+
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
150+
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
151+
context[constants.CTX_VERBOSE] = true
152+
153+
commands := []types.Command{
154+
&builder.SetupHumanLoggerIfMissing{},
155+
156+
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
157+
158+
&builder.ContainerMergeCopySketchFiles{},
159+
160+
&builder.ContainerFindIncludes{},
161+
162+
&builder.PrintUsedLibrariesIfVerbose{},
163+
&builder.WarnAboutArchIncompatibleLibraries{},
164+
&builder.CTagsTargetFileSaver{SourceField: constants.CTX_SOURCE},
165+
&builder.CTagsRunner{},
166+
}
167+
168+
for _, command := range commands {
169+
err := command.Run(context)
170+
NoError(t, err)
171+
}
172+
173+
ctagsTempFileName := context[constants.CTX_CTAGS_TEMP_FILE_NAME].(string)
174+
expectedOutput := "Foo\t" + ctagsTempFileName + "\t/^ struct Foo{$/;\"\tkind:struct\tline:3\n" +
175+
"setup\t" + ctagsTempFileName + "\t/^void setup() {$/;\"\tkind:function\tline:7\tsignature:()\treturntype:void\n" +
176+
"loop\t" + ctagsTempFileName + "\t/^void loop() {}$/;\"\tkind:function\tline:11\tsignature:()\treturntype:void\n" +
177+
"func\t" + ctagsTempFileName + "\t/^typename Foo<char>::Bar func(){$/;\"\tkind:function\tline:13\tsignature:()\treturntype:Foo::Bar\n"
178+
179+
require.Equal(t, expectedOutput, strings.Replace(context[constants.CTX_CTAGS_OUTPUT].(string), "\r\n", "\n", -1))
180+
}

Diff for: src/arduino.cc/builder/test/helper_tools_downloader.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ func DownloadCoresAndToolsAndLibraries(t *testing.T) {
107107
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/coan-5.2-i686-mingw32.zip"},
108108
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/coan-5.2-x86_64-apple-darwin.zip"},
109109
}},
110-
Tool{Name: "ctags", Version: "5.8-arduino1",
110+
Tool{Name: "ctags", Version: "5.8-arduino2",
111111
OsUrls: []OsUrl{
112-
OsUrl{Os: "i686-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-i686-pc-linux-gnu.tar.bz2"},
113-
OsUrl{Os: "x86_64-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-x86_64-pc-linux-gnu.tar.bz2"},
114-
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-i686-mingw32.zip"},
115-
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-x86_64-apple-darwin.zip"},
112+
OsUrl{Os: "i686-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino2-i686-pc-linux-gnu.tar.bz2"},
113+
OsUrl{Os: "x86_64-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino2-x86_64-pc-linux-gnu.tar.bz2"},
114+
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino2-i686-mingw32.zip"},
115+
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino2-x86_64-apple-darwin.zip"},
116116
}},
117117
}
118118

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
template< typename T >
2+
struct Foo{
3+
typedef T Bar;
4+
};
5+
6+
void setup() {
7+
func();
8+
}
9+
10+
void loop() {}
11+
12+
typename Foo<char>::Bar func(){
13+
14+
}

0 commit comments

Comments
 (0)