Skip to content

Commit 8c90790

Browse files
Migrated TestCompileWithBuildPropertyContainingQuotes from
test_compile_part_1.py to compile_part_1_test.go
1 parent 5512924 commit 8c90790

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

Diff for: internal/integrationtest/compile/compile_part_1_test.go

+35
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,38 @@ func TestCompileWithBuildPropertiesFlag(t *testing.T) {
380380
require.Contains(t, string(stdout), "-DFIRST_PIN=1")
381381
require.Contains(t, string(stdout), "-DSECOND_PIN=2")
382382
}
383+
384+
func TestCompileWithBuildPropertyContainingQuotes(t *testing.T) {
385+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
386+
defer env.CleanUp()
387+
388+
// Init the environment explicitly
389+
_, _, err := cli.Run("core", "update-index")
390+
require.NoError(t, err)
391+
392+
// Install Arduino AVR Boards
393+
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
394+
require.NoError(t, err)
395+
396+
// Copy sketch
397+
sketchName := "sketch_with_single_string_define"
398+
p, err := paths.Getwd()
399+
require.NoError(t, err)
400+
require.NotNil(t, p)
401+
testSketch := p.Parent().Join("testdata", sketchName)
402+
sketchPath := cli.SketchbookDir().Join(sketchName)
403+
err = testSketch.CopyDirTo(sketchPath)
404+
require.NoError(t, err)
405+
406+
fqbn := "arduino:avr:uno"
407+
408+
// Compile using a build property with quotes
409+
stdout, _, err := cli.Run("compile",
410+
"-b",
411+
fqbn,
412+
`--build-property=build.extra_flags="-DMY_DEFINE="hello world""`,
413+
sketchPath.String(),
414+
"--verbose")
415+
require.NoError(t, err)
416+
require.Contains(t, string(stdout), `-DMY_DEFINE=\"hello world\"`)
417+
}

Diff for: test/test_compile_part_1.py

-25
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,6 @@ def test_compile_without_precompiled_libraries(run_command, data_dir):
6060
assert run_command(["compile", "-b", "arduino:samd:mkrvidor4000", sketch_path])
6161

6262

63-
def test_compile_with_build_property_containing_quotes(run_command, data_dir, copy_sketch):
64-
# Init the environment explicitly
65-
assert run_command(["core", "update-index"])
66-
67-
# Install Arduino AVR Boards
68-
assert run_command(["core", "install", "arduino:[email protected]"])
69-
70-
sketch_path = copy_sketch("sketch_with_single_string_define")
71-
fqbn = "arduino:avr:uno"
72-
73-
# Compile using a build property with quotes
74-
res = run_command(
75-
[
76-
"compile",
77-
"-b",
78-
fqbn,
79-
'--build-property=build.extra_flags=\\"-DMY_DEFINE=\\"hello world\\"\\"',
80-
sketch_path,
81-
"--verbose",
82-
]
83-
)
84-
assert res.ok
85-
assert '-DMY_DEFINE=\\"hello world\\"' in res.stdout
86-
87-
8863
def test_compile_with_multiple_build_property_flags(run_command, data_dir, copy_sketch, working_dir):
8964
# Init the environment explicitly
9065
assert run_command(["core", "update-index"])

0 commit comments

Comments
 (0)