Skip to content

Commit

Permalink
Merge pull request #1481 from xodio/fix-1479-upload-to-pro
Browse files Browse the repository at this point in the history
Fix option parser: Match any character as option name
  • Loading branch information
brusherru committed Oct 18, 2018
2 parents 1c07973 + 448845e commit a76be3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions packages/arduino-cli/src/optionParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const getLines = R.compose(

const menuRegExp = /^menu\./;

const optionNameRegExp = /^menu\.([a-zA-Z0-9_]+)=([a-zA-Z0-9-_ ]+)$/;
const optionNameRegExp = /^menu\.([a-zA-Z0-9_]+)=(.+)$/;

const boardOptionRegExp = /^([a-zA-Z0-9_]+)\.menu\.([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)=([a-zA-Z0-9-_ ()]+)$/;
const boardOptionRegExp = /^([a-zA-Z0-9_]+)\.menu\.([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)=(.+)$/;

const osRegExp = /(linux|macosx|windows)/;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#### JUST A PART OF BOARDS.TXT FILE FROM ESP8266 PACKAGE
#### SOME OPTIONS WAS REMOVED TO MINIFY FIXTURE
#### A PART OF BOARDS.TXT FILE FROM ESP8266 PACKAGE
#### WITH SOME CHANGES: MENU AND OPTION NAMES
#### NOW CONTAINS SPECIAL CHARACTERS AND CYRILLIC SYMBOLS
#### TO MAKE SURE IN THE UNIT TESTS IT WILL WORK FINE
#### WITH ANY PACKAGE.
####
#### ONLY FOR TESTS!

#
# Do not create pull-requests for this file only, CI will not accept them.
# You *must* edit/modify/run boards.txt.py to regenerate boards.txt.
# All modified files after running with option "--allgen" must be included in the pull-request.
#

menu.UploadSpeed=Upload Speed
menu.CpuFrequency=CPU Frequency
menu.UploadSpeed=Uplo@d Speed (Скорость загрузки)
menu.CpuFrequency=CPU Frequency 123,-_[]():@we$ome

##############################################################
generic.name=Generic ESP8266 Module
Expand All @@ -26,7 +24,7 @@ generic.build.variant=generic
generic.build.spiffs_pagesize=256
generic.build.debug_port=
generic.build.debug_level=
generic.menu.CpuFrequency.80=80 MHz
generic.menu.CpuFrequency.80=80 MHz (!@#$$%^&*()[]_-+,./)
generic.menu.CpuFrequency.80.build.f_cpu=80000000L
generic.menu.CpuFrequency.160=160 MHz
generic.menu.CpuFrequency.160.build.f_cpu=160000000L
Expand Down Expand Up @@ -64,7 +62,7 @@ wifi_slot.build.core=esp8266
wifi_slot.build.spiffs_pagesize=256
wifi_slot.build.debug_port=
wifi_slot.build.debug_level=
wifi_slot.menu.CpuFrequency.80=80 MHz
wifi_slot.menu.CpuFrequency.80=80 MHz (!@#$$%^&*()[]_-+,./)
wifi_slot.menu.CpuFrequency.80.build.f_cpu=80000000L
wifi_slot.menu.CpuFrequency.160=160 MHz
wifi_slot.menu.CpuFrequency.160.build.f_cpu=160000000L
Expand Down
12 changes: 6 additions & 6 deletions packages/arduino-cli/test/optionParser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const fixtureDir = path.resolve(__dirname, 'fixtures');
// =============================================================================

const espOptionNames = {
UploadSpeed: 'Upload Speed',
CpuFrequency: 'CPU Frequency',
UploadSpeed: 'Uplo@d Speed (Скорость загрузки)',
CpuFrequency: 'CPU Frequency 123,-_[]():@we$ome',
};

const espOptions = {
Expand All @@ -47,7 +47,7 @@ const espOptions = {
],
CpuFrequency: [
{
name: '80 MHz',
name: '80 MHz (!@#$$%^&*()[]_-+,./)',
value: '80',
},
{
Expand All @@ -58,7 +58,7 @@ const espOptions = {
};

const uploadSpeedOptions = {
optionName: 'Upload Speed',
optionName: 'Uplo@d Speed (Скорость загрузки)',
optionId: 'UploadSpeed',
values: [
{
Expand All @@ -80,11 +80,11 @@ const uploadSpeedOptions = {
],
};
const cpuFrequencyOptions = {
optionName: 'CPU Frequency',
optionName: 'CPU Frequency 123,-_[]():@we$ome',
optionId: 'CpuFrequency',
values: [
{
name: '80 MHz',
name: '80 MHz (!@#$$%^&*()[]_-+,./)',
value: '80',
},
{
Expand Down

0 comments on commit a76be3a

Please sign in to comment.