Golang arduino-cc-builder.AddAdditionalEntriesToContext类(方法)实例源码

下面列出了Golang arduino-cc-builder.AddAdditionalEntriesToContext 类(方法)源码代码实例,从而了解它的用法。

作者:ricklo    项目:arduino-builde   
func TestAddAdditionalEntriesToContextNoBuildPath(t *testing.T) {
	context := make(map[string]interface{})

	command := builder.AddAdditionalEntriesToContext{}
	NoError(t, command.Run(context))

	require.Nil(t, context[constants.CTX_PREPROC_PATH])
	require.Nil(t, context[constants.CTX_SKETCH_BUILD_PATH])
	require.Nil(t, context[constants.CTX_LIBRARIES_BUILD_PATH])
	require.Nil(t, context[constants.CTX_CORE_BUILD_PATH])

	require.NotNil(t, context[constants.CTX_WARNINGS_LEVEL])
	require.NotNil(t, context[constants.CTX_VERBOSE])
	require.NotNil(t, context[constants.CTX_DEBUG_LEVEL])
	require.NotNil(t, context[constants.CTX_LIBRARY_DISCOVERY_RECURSION_DEPTH])
}

作者:facchin    项目:arduino-builde   
func TestAddAdditionalEntriesToContextNoBuildPath(t *testing.T) {
	ctx := &types.Context{}

	command := builder.AddAdditionalEntriesToContext{}
	NoError(t, command.Run(ctx))

	require.Empty(t, ctx.PreprocPath)
	require.Empty(t, ctx.SketchBuildPath)
	require.Empty(t, ctx.LibrariesBuildPath)
	require.Empty(t, ctx.CoreBuildPath)

	require.NotNil(t, ctx.WarningsLevel)

	require.True(t, ctx.CollectedSourceFiles.Empty())

	require.Equal(t, 0, len(ctx.LibrariesResolutionResults))
}

作者:facchin    项目:arduino-builde   
func TestAddAdditionalEntriesToContextWithBuildPath(t *testing.T) {
	ctx := &types.Context{}
	ctx.BuildPath = "folder"

	command := builder.AddAdditionalEntriesToContext{}
	NoError(t, command.Run(ctx))

	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_PREPROC)), ctx.PreprocPath)
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_SKETCH)), ctx.SketchBuildPath)
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_LIBRARIES)), ctx.LibrariesBuildPath)
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_CORE)), ctx.CoreBuildPath)

	require.NotNil(t, ctx.WarningsLevel)

	require.True(t, ctx.CollectedSourceFiles.Empty())

	require.Equal(t, 0, len(ctx.LibrariesResolutionResults))
}

作者:ricklo    项目:arduino-builde   
func TestAddAdditionalEntriesToContextWithBuildPath(t *testing.T) {
	context := make(map[string]interface{})

	context[constants.CTX_BUILD_PATH] = "folder"

	command := builder.AddAdditionalEntriesToContext{}
	NoError(t, command.Run(context))

	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_PREPROC)), context[constants.CTX_PREPROC_PATH])
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_SKETCH)), context[constants.CTX_SKETCH_BUILD_PATH])
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_LIBRARIES)), context[constants.CTX_LIBRARIES_BUILD_PATH])
	require.Equal(t, Abs(t, filepath.Join("folder", constants.FOLDER_CORE)), context[constants.CTX_CORE_BUILD_PATH])

	require.NotNil(t, context[constants.CTX_WARNINGS_LEVEL])
	require.NotNil(t, context[constants.CTX_VERBOSE])
	require.NotNil(t, context[constants.CTX_DEBUG_LEVEL])
	require.NotNil(t, context[constants.CTX_LIBRARY_DISCOVERY_RECURSION_DEPTH])
}

作者:andy52    项目:arduino-builde   
func TestAddAdditionalEntriesToContextNoBuildPath(t *testing.T) {
	context := make(map[string]interface{})

	command := builder.AddAdditionalEntriesToContext{}
	NoError(t, command.Run(context))

	require.Nil(t, context[constants.CTX_PREPROC_PATH])
	require.Nil(t, context[constants.CTX_SKETCH_BUILD_PATH])
	require.Nil(t, context[constants.CTX_LIBRARIES_BUILD_PATH])
	require.Nil(t, context[constants.CTX_CORE_BUILD_PATH])

	require.NotNil(t, context[constants.CTX_WARNINGS_LEVEL])
	require.NotNil(t, context[constants.CTX_VERBOSE])
	require.NotNil(t, context[constants.CTX_DEBUG_LEVEL])

	require.True(t, context[constants.CTX_COLLECTED_SOURCE_FILES_QUEUE].(*types.UniqueStringQueue).Empty())
	require.True(t, context[constants.CTX_FOLDERS_WITH_SOURCES_QUEUE].(*types.UniqueSourceFolderQueue).Empty())

	require.Equal(t, 0, len(context[constants.CTX_LIBRARY_RESOLUTION_RESULTS].(map[string]types.LibraryResolutionResult)))
}


问题


面经


文章

微信
公众号

扫码关注公众号