func TestDontGenerateBuildPathIfPresent(t *testing.T) {
	ctx := &types.Context{}
	ctx.BuildPath = "test"

	createBuildPathIfMissing := builder.GenerateBuildPathIfMissing{}
	err := createBuildPathIfMissing.Run(ctx)
	NoError(t, err)

	require.Equal(t, "test", ctx.BuildPath)
}
func TestDontGenerateBuildPathIfPresent(t *testing.T) {
	context := make(map[string]interface{})

	context[constants.CTX_BUILD_PATH] = "test"

	createBuildPathIfMissing := builder.GenerateBuildPathIfMissing{}
	err := createBuildPathIfMissing.Run(context)
	NoError(t, err)

	require.Equal(t, "test", context[constants.CTX_BUILD_PATH])
}
func TestGenerateBuildPathIfMissing(t *testing.T) {
	context := make(map[string]interface{})

	context[constants.CTX_SKETCH_LOCATION] = "test"

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

	require.Equal(t, filepath.Join(os.TempDir(), "arduino-sketch-098F6BCD4621D373CADE4E832627B4F6"), context[constants.CTX_BUILD_PATH])
	_, err = os.Stat(filepath.Join(os.TempDir(), "arduino-sketch-098F6BCD4621D373CADE4E832627B4F6"))
	require.True(t, os.IsNotExist(err))
}
func TestGenerateBuildPathIfEmpty(t *testing.T) {
	ctx := &types.Context{
		SketchLocation: "test",
	}

	createBuildPathIfMissing := builder.GenerateBuildPathIfMissing{}
	err := createBuildPathIfMissing.Run(ctx)
	NoError(t, err)

	require.Equal(t, filepath.Join(os.TempDir(), "arduino-sketch-098F6BCD4621D373CADE4E832627B4F6"), ctx.BuildPath)
	_, err = os.Stat(filepath.Join(os.TempDir(), "arduino-sketch-098F6BCD4621D373CADE4E832627B4F6"))
	require.True(t, os.IsNotExist(err))
}