コード例 #1
0
func TestGCCMinusMOutputParserFirstLineOnMultipleLines(t *testing.T) {
	context := make(map[string]interface{})

	output := "sketch_with_config.ino.o: \\\n" +
		" /tmp/test097286304/sketch/sketch_with_config.ino.cpp \\\n" +
		" /tmp/test097286304/sketch/config.h \\\n" +
		" /tmp/test097286304/sketch/includes/de\\ bug.h Bridge.h\n" +
		"\n" +
		"/tmp/test097286304/sketch/config.h:\n" +
		"\n" +
		"/tmp/test097286304/sketch/includes/de\\ bug.h:\n" +
		"\n" +
		"Bridge.h:\n"

	context[constants.CTX_GCC_MINUS_M_OUTPUT] = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(context)
	NoError(t, err)

	require.NotNil(t, context[constants.CTX_INCLUDES])
	includes := context[constants.CTX_INCLUDES].([]string)
	require.Equal(t, 3, len(includes))
	require.Equal(t, "/tmp/test097286304/sketch/config.h", includes[0])
	require.Equal(t, "/tmp/test097286304/sketch/includes/de bug.h", includes[1])
	require.Equal(t, "Bridge.h", includes[2])
}
コード例 #2
0
func TestGCCMinusMOutputParserFirstLineOnMultipleLines(t *testing.T) {
	ctx := &types.Context{}

	output := "sketch_with_config.ino.o: \\\n" +
		" /tmp/test097286304/sketch/sketch_with_config.ino.cpp \\\n" +
		" /tmp/test097286304/sketch/config.h \\\n" +
		" /tmp/test097286304/sketch/includes/de\\ bug.h Bridge.h\n" +
		"\n" +
		"/tmp/test097286304/sketch/config.h:\n" +
		"\n" +
		"/tmp/test097286304/sketch/includes/de\\ bug.h:\n" +
		"\n" +
		"Bridge.h:\n"

	ctx.OutputGccMinusM = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(ctx)
	NoError(t, err)

	includes := ctx.Includes
	require.Equal(t, 3, len(includes))
	require.Equal(t, "/tmp/test097286304/sketch/config.h", includes[0])
	require.Equal(t, "/tmp/test097286304/sketch/includes/de bug.h", includes[1])
	require.Equal(t, "Bridge.h", includes[2])
}
コード例 #3
0
func TestGCCMinusMOutputParserEmptyOutput(t *testing.T) {
	ctx := &types.Context{}

	output := "sketch.ino.o: /tmp/test699709208/sketch/sketch.ino.cpp"

	ctx.OutputGccMinusM = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(ctx)
	NoError(t, err)

	includes := ctx.Includes
	require.Equal(t, 0, len(includes))
}
コード例 #4
0
func TestGCCMinusMOutputParserEmptyOutput(t *testing.T) {
	context := make(map[string]interface{})

	output := "sketch.ino.o: /tmp/test699709208/sketch/sketch.ino.cpp"

	context[constants.CTX_GCC_MINUS_M_OUTPUT] = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(context)
	NoError(t, err)

	require.NotNil(t, context[constants.CTX_INCLUDES])
	includes := context[constants.CTX_INCLUDES].([]string)
	require.Equal(t, 0, len(includes))
}
コード例 #5
0
func TestGCCMinusMOutputParser(t *testing.T) {
	ctx := &types.Context{}

	output := "sketch_with_config.o: sketch_with_config.ino config.h de\\ bug.h Bridge.h\n" +
		"\n" +
		"config.h:\n" +
		"\n" +
		"de\\ bug.h:\n" +
		"\n" +
		"Bridge.h:\n"

	ctx.OutputGccMinusM = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(ctx)
	NoError(t, err)

	includes := ctx.Includes
	require.Equal(t, 3, len(includes))
	require.Equal(t, "config.h", includes[0])
	require.Equal(t, "de bug.h", includes[1])
	require.Equal(t, "Bridge.h", includes[2])
}
コード例 #6
0
func TestGCCMinusMOutputParser(t *testing.T) {
	context := make(map[string]interface{})

	output := "sketch_with_config.o: sketch_with_config.ino config.h de\\ bug.h Bridge.h\n" +
		"\n" +
		"config.h:\n" +
		"\n" +
		"de\\ bug.h:\n" +
		"\n" +
		"Bridge.h:\n"

	context[constants.CTX_GCC_MINUS_M_OUTPUT] = output

	parser := builder.GCCMinusMOutputParser{}
	err := parser.Run(context)
	NoError(t, err)

	require.NotNil(t, context[constants.CTX_INCLUDES])
	includes := context[constants.CTX_INCLUDES].([]string)
	require.Equal(t, 3, len(includes))
	require.Equal(t, "config.h", includes[0])
	require.Equal(t, "de bug.h", includes[1])
	require.Equal(t, "Bridge.h", includes[2])
}