func TestCTagsParserShouldDealWithStructs(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithStructs.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "A_NEW_TYPE", ctags[idx].FunctionName)
	require.Equal(t, "struct", ctags[idx].Kind)
	idx++
	require.Equal(t, "foo", ctags[idx].FunctionName)
	require.Equal(t, "variable", ctags[idx].Kind)
	require.Equal(t, "struct:A_NEW_TYPE", ctags[idx].Typeref)
	idx++
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "dostuff", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
}
func TestCTagsParserClassMembersAreFilteredOut(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserClassMembersAreFilteredOut.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "set_values", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "prototype", ctags[idx]["kind"])
	require.Equal(t, "Rectangle", ctags[idx]["class"])
	idx++
	require.Equal(t, "area", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	require.Equal(t, "Rectangle", ctags[idx]["class"])
	idx++
	require.Equal(t, "set_values", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	require.Equal(t, "Rectangle", ctags[idx]["class"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
func TestCTagsParserFunctionPointer(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserFunctionPointer.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 4, len(ctags))
	idx := 0
	require.Equal(t, "t1Callback", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "variable", ctags[idx]["kind"])
	idx++
	require.Equal(t, "t1Callback", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
func TestCTagsParserFunctionPointers(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserFunctionPointers.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "func", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "funcArr", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	require.Equal(t, "()", ctags[idx]["signature"])
	idx++
	require.Equal(t, "funcCombo", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	require.Equal(t, "(void (*(&in)[5])(int))", ctags[idx]["signature"])

}
func TestCTagsParserFunctionPointers(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserFunctionPointers.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "func", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "funcArr", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "()", ctags[idx].Signature)
	idx++
	require.Equal(t, "funcCombo", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "(void (*(&in)[5])(int))", ctags[idx].Signature)

}
func TestCTagsParserShouldListTemplates(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListTemplates.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 3, len(ctags))
	idx := 0
	require.Equal(t, "minimum", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "(T a, T b)", ctags[idx].Signature)
	idx++
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
}
func TestCTagsParserFunctionPointer(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserFunctionPointer.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 4, len(ctags))
	idx := 0
	require.Equal(t, "t1Callback", ctags[idx].FunctionName)
	require.Equal(t, "variable", ctags[idx].Kind)
	idx++
	require.Equal(t, "t1Callback", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
}
func TestCTagsParserClassMembersAreFilteredOut(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserClassMembersAreFilteredOut.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "set_values", ctags[idx].FunctionName)
	require.Equal(t, "prototype", ctags[idx].Kind)
	require.Equal(t, "Rectangle", ctags[idx].Class)
	idx++
	require.Equal(t, "area", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "Rectangle", ctags[idx].Class)
	idx++
	require.Equal(t, "set_values", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "Rectangle", ctags[idx].Class)
	idx++
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
}
func TestCTagsParserShouldDealWithStructs(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithStructs.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 5, len(ctags))
	idx := 0
	require.Equal(t, "A_NEW_TYPE", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "struct", ctags[idx]["kind"])
	idx++
	require.Equal(t, "foo", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "variable", ctags[idx]["kind"])
	require.Equal(t, "struct:A_NEW_TYPE", ctags[idx]["typeref"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "dostuff", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
func TestCTagsParserShouldListTemplates(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListTemplates.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 3, len(ctags))
	idx := 0
	require.Equal(t, "minimum", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	require.Equal(t, "(T a, T b)", ctags[idx]["signature"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
Esempio n. 11
0
func TestCTagsParserShouldDealWithClasses(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithClasses.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 0, len(prototypes))
}
Esempio n. 12
0
func TestCTagsParserShouldDealFunctionWithDifferentSignatures(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealFunctionWithDifferentSignatures.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 1, len(prototypes))
	require.Equal(t, "boolean getBytes( byte addr, int amount );", prototypes[0])
}
Esempio n. 13
0
func TestCTagsParserShouldListPrototypes(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListPrototypes.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 8, len(ctags))
	idx := 0
	require.Equal(t, "server", ctags[idx].FunctionName)
	require.Equal(t, "variable", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "setup", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "loop", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "process", ctags[idx].FunctionName)
	require.Equal(t, "prototype", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "process", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "digitalCommand", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "analogCommand", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
	idx++
	require.Equal(t, "modeCommand", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
	require.Equal(t, "/tmp/sketch7210316334309249705.cpp", ctags[idx].Filename)
}
Esempio n. 14
0
func TestCTagsParserStructWithFunctions(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserStructWithFunctions.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 2, len(prototypes))
	require.Equal(t, "void setup();", prototypes[0])
	require.Equal(t, "void loop();", prototypes[1])
}
func TestCTagsParserShouldDealWithStructs(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithStructs.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]*types.Prototype)

	require.Equal(t, 3, len(prototypes))
	require.Equal(t, "void setup();", prototypes[0].Prototype)
	require.Equal(t, "void loop();", prototypes[1].Prototype)
	require.Equal(t, "void dostuff(A_NEW_TYPE * bar);", prototypes[2].Prototype)
}
Esempio n. 16
0
func TestCTagsParserShouldListTemplates(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListTemplates.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 3, len(prototypes))
	require.Equal(t, "template <typename T> T minimum (T a, T b);", prototypes[0])
	require.Equal(t, "void setup();", prototypes[1])
	require.Equal(t, "void loop();", prototypes[2])
}
Esempio n. 17
0
func TestCTagsParserShouldListTemplates2(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListTemplates2.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 4, len(prototypes))
	require.Equal(t, "void setup();", prototypes[0])
	require.Equal(t, "void loop();", prototypes[1])
	require.Equal(t, "template <class T> int SRAM_writeAnything(int ee, const T& value);", prototypes[2])
	require.Equal(t, "template <class T> int SRAM_readAnything(int ee, T& value);", prototypes[3])
}
Esempio n. 18
0
func TestCTagsParserShouldDealWithMacros(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithMacros.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 5, len(prototypes))
	require.Equal(t, "void setup();", prototypes[0])
	require.Equal(t, "void loop();", prototypes[1])
	require.Equal(t, "void debug();", prototypes[2])
	require.Equal(t, "void disabledIsDefined();", prototypes[3])
	require.Equal(t, "int useMyType(MyType type);", prototypes[4])
}
Esempio n. 19
0
func TestCTagsParserShouldListPrototypes(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListPrototypes.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{PrototypesField: constants.CTX_PROTOTYPES}
	ctagsParser.Run(context)

	prototypes := context[constants.CTX_PROTOTYPES].([]string)

	require.Equal(t, 5, len(prototypes))
	require.Equal(t, "void setup();", prototypes[0])
	require.Equal(t, "void loop();", prototypes[1])
	require.Equal(t, "void digitalCommand(YunClient client);", prototypes[2])
	require.Equal(t, "void analogCommand(YunClient client);", prototypes[3])
	require.Equal(t, "void modeCommand(YunClient client);", prototypes[4])
}
Esempio n. 20
0
func TestCTagsParserShouldDealWithClasses(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithClasses.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_PREPROC_SOURCE].([]*types.CTag)

	require.Equal(t, 2, len(ctags))
	idx := 0
	require.Equal(t, "SleepCycle", ctags[idx].FunctionName)
	require.Equal(t, "prototype", ctags[idx].Kind)
	idx++
	require.Equal(t, "SleepCycle", ctags[idx].FunctionName)
	require.Equal(t, "function", ctags[idx].Kind)
}
func TestCTagsParserShouldDealWithClasses(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithClasses.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 2, len(ctags))
	idx := 0
	require.Equal(t, "SleepCycle", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "prototype", ctags[idx]["kind"])
	idx++
	require.Equal(t, "SleepCycle", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
func TestCTagsParserShouldListPrototypes(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldListPrototypes.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 8, len(ctags))
	idx := 0
	require.Equal(t, "server", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "variable", ctags[idx]["kind"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "process", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "prototype", ctags[idx]["kind"])
	idx++
	require.Equal(t, "process", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "digitalCommand", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "analogCommand", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "modeCommand", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}
func TestCTagsParserShouldDealWithMacros(t *testing.T) {
	context := make(map[string]interface{})

	bytes, err := ioutil.ReadFile(filepath.Join("ctags_output", "TestCTagsParserShouldDealWithMacros.txt"))
	NoError(t, err)

	context[constants.CTX_CTAGS_OUTPUT] = string(bytes)

	ctagsParser := builder.CTagsParser{CTagsField: constants.CTX_CTAGS_OF_SOURCE}
	ctagsParser.Run(context)

	ctags := context[constants.CTX_CTAGS_OF_SOURCE].([]map[string]string)

	require.Equal(t, 8, len(ctags))
	idx := 0
	require.Equal(t, "DEBUG", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "macro", ctags[idx]["kind"])
	idx++
	require.Equal(t, "DISABLED", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "macro", ctags[idx]["kind"])
	idx++
	require.Equal(t, "hello", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "variable", ctags[idx]["kind"])
	idx++
	require.Equal(t, "setup", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "loop", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "debug", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "disabledIsDefined", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
	idx++
	require.Equal(t, "useMyType", ctags[idx][constants.CTAGS_FIELD_FUNCTION_NAME])
	require.Equal(t, "function", ctags[idx]["kind"])
}