Skip to content

Commit ec0b021

Browse files
committed
Add test for arduino#180
1 parent 9165d1b commit ec0b021

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/arduino.cc/builder/ctags/ctags_to_prototypes_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@ func TestCTagsToPrototypesFunctionPointers(t *testing.T) {
209209
require.Equal(t, 2, line)
210210
}
211211

212+
func TestCTagsToPrototypesFunctionPointersNoIndirect(t *testing.T) {
213+
prototypes, line := producePrototypes(t, "TestCTagsParserFunctionPointersNoIndirect.txt")
214+
require.Equal(t, 5, len(prototypes))
215+
require.Equal(t, "void setup();", prototypes[0].Prototype)
216+
require.Equal(t, "/tmp/test547238273/preproc/bug_callback.ino", prototypes[0].File)
217+
require.Equal(t, "void loop();", prototypes[1].Prototype)
218+
219+
require.Equal(t, 10, line)
220+
}
221+
212222
func TestCTagsRunnerSketchWithClassFunction(t *testing.T) {
213223
prototypes, _ := producePrototypes(t, "TestCTagsRunnerSketchWithClassFunction.txt")
214224

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
BUG /tmp/test547238273/preproc/bug_callback.ino /^ public: BUG(void (*fn)(void)) {}$/;" kind:function line:6 class:BUG signature:(void (*fn)(void))
2+
b /tmp/test547238273/preproc/bug_callback.ino /^BUG b(makeItBreak); \/\/this will break$/;" kind:prototype line:10 signature:(makeItBreak)returntype:BUG
3+
setup /tmp/test547238273/preproc/bug_callback.ino /^void setup() {$/;" kind:function line:12 signature:() returntype:void
4+
loop /tmp/test547238273/preproc/bug_callback.ino /^void loop() {}$/;" kind:function line:16 signature:() returntype:void
5+
makeItBreak /tmp/test547238273/preproc/bug_callback.ino /^void makeItBreak() {}$/;" kind:function line:18 signature:() returntype:void
6+
caller /tmp/test547238273/preproc/bug_callback.ino /^void caller(int (*cc)(int ),int a) {$/;" kind:function line:20 signature:(int (*cc)(int ),int a) returntype:void
7+
blub /tmp/test547238273/preproc/bug_callback.ino /^int blub(int a) {$/;" kind:function line:24 signature:(int a) returntype:int

0 commit comments

Comments
 (0)