Fix INO to CPP converting when 2-tokens type is used

This commit is contained in:
Ivan Kravets
2016-08-31 12:49:10 +03:00
parent 1b32091d7d
commit 3a7b0d2c9d
6 changed files with 15 additions and 12 deletions

View File

@ -14,7 +14,7 @@
import sys import sys
VERSION = (3, 0, "0b2") VERSION = (3, 0, "0b3")
__version__ = ".".join([str(s) for s in VERSION]) __version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio" __title__ = "platformio"

View File

@ -31,8 +31,8 @@ from platformio import util
class InoToCPPConverter(object): class InoToCPPConverter(object):
PROTOTYPE_RE = re.compile(r"""^( PROTOTYPE_RE = re.compile(r"""^(
([a-z_\d]+\*?){1,2} # return type ([a-z_\d]+\*?\s+){1,2} # return type
(\s+[a-z_\d]+\s*) # name of prototype ([a-z_\d]+\s*) # name of prototype
\([a-z_,\.\*\&\[\]\s\d]*\) # arguments \([a-z_,\.\*\&\[\]\s\d]*\) # arguments
)\s*\{ # must end with { )\s*\{ # must end with {
""", re.X | re.M | re.I) """, re.X | re.M | re.I)

View File

@ -32,7 +32,6 @@ def validate_cliresult():
def decorator(result): def decorator(result):
assert result.exit_code == 0 assert result.exit_code == 0
assert not result.exception assert not result.exception
assert "error" not in result.output.lower()
return decorator return decorator

View File

@ -1,3 +1,4 @@
void barFunc () { // my comment unsigned int barFunc () // my comment
{
return 0;
} }

View File

@ -9,5 +9,5 @@ void loop() {
} }
char* fooFunc() { char* fooFunc() {
return buf; return buf;
} }

View File

@ -19,7 +19,6 @@ from os.path import dirname, getsize, isdir, isfile, join, normpath
import pytest import pytest
from platformio import util from platformio import util
from platformio.commands.run import cli as cmd_run
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):
@ -35,12 +34,16 @@ def pytest_generate_tests(metafunc):
metafunc.parametrize("pioproject_dir", project_dirs) metafunc.parametrize("pioproject_dir", project_dirs)
def test_run(clirunner, validate_cliresult, pioproject_dir): @pytest.mark.examples
def test_run(pioproject_dir):
if isdir(join(pioproject_dir, ".pioenvs")): if isdir(join(pioproject_dir, ".pioenvs")):
util.rmtree_(join(pioproject_dir, ".pioenvs")) util.rmtree_(join(pioproject_dir, ".pioenvs"))
result = clirunner.invoke(cmd_run, ["-d", pioproject_dir]) result = util.exec_command(
validate_cliresult(result) ["platformio", "--force", "run", "--project-dir", pioproject_dir]
)
if result['returncode'] != 0:
pytest.fail(result)
# check .elf file # check .elf file
pioenvs_dir = join(pioproject_dir, ".pioenvs") pioenvs_dir = join(pioproject_dir, ".pioenvs")