Skip to content

Commit 79aa271

Browse files
Migrate TestCompileWithBuildPropertyContainingQuotes from
test_compile_part_1.py to compile_part_1_test.go
1 parent 436f106 commit 79aa271

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
@@ -25,31 +25,6 @@
2525
from .common import running_on_ci
2626

2727

28-
def test_compile_with_build_property_containing_quotes(run_command, data_dir, copy_sketch):
29-
# Init the environment explicitly
30-
assert run_command(["core", "update-index"])
31-
32-
# Install Arduino AVR Boards
33-
assert run_command(["core", "install", "arduino:[email protected]"])
34-
35-
sketch_path = copy_sketch("sketch_with_single_string_define")
36-
fqbn = "arduino:avr:uno"
37-
38-
# Compile using a build property with quotes
39-
res = run_command(
40-
[
41-
"compile",
42-
"-b",
43-
fqbn,
44-
'--build-property=build.extra_flags=\\"-DMY_DEFINE=\\"hello world\\"\\"',
45-
sketch_path,
46-
"--verbose",
47-
]
48-
)
49-
assert res.ok
50-
assert '-DMY_DEFINE=\\"hello world\\"' in res.stdout
51-
52-
5328
def test_compile_with_multiple_build_property_flags(run_command, data_dir, copy_sketch, working_dir):
5429
# Init the environment explicitly
5530
assert run_command(["core", "update-index"])

0 commit comments

Comments
 (0)