Skip to content

Commit 6f47241

Browse files
author
jantje
committed
#687 also added regression test
1 parent 3677ffe commit 6f47241

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

io.sloeber.core/src/io/sloeber/core/tools/PdePreprocessor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static void processProject(IProject iProject) throws CoreException {
126126
addString = addString.replaceAll("\r", NEWLINE);
127127
addString = addString.replaceAll("//[^\n]+\n", " ");
128128
addString = addString.replaceAll("\n", " ");
129-
addString = addString.replaceAll("\\{.+\\}", "");
129+
addString = addString.replaceAll("\\{.*\\}", "");
130130
if (addString.contains("=") || addString.contains("::")) {
131131
// ignore when there are assignments in the
132132
// declaration

io.sloeber.core/src/jUnit/Regression.java

+30
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ public void issue555() {
115115
}
116116
}
117117

118+
/**
119+
* support void loop{};
120+
*/
121+
@SuppressWarnings("static-method")
122+
@Test
123+
public void issue687() {
124+
Map<String, String> unoOptions = new HashMap<>();
125+
BoardDescriptor unoBoardid = BoardsManager.getBoardID("package_index.json", "arduino", "Arduino AVR Boards",
126+
"uno", unoOptions);
127+
128+
IProject theTestProject = null;
129+
String projectName = "issue687";
130+
IPath templateFolder = Shared.getTemplateFolder(projectName);
131+
CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
132+
try {
133+
theTestProject = unoBoardid.createProject(projectName, null,
134+
ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null),
135+
new NullProgressMonitor());
136+
Shared.waitForAllJobsToFinish(); // for the indexer
137+
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
138+
if (Shared.hasBuildErrors(theTestProject)) {
139+
fail("Failed to compile the project:" + projectName + " issue687 is not fixed");
140+
}
141+
} catch (Exception e) {
142+
fail("Failed to create the project:" + projectName + " issue687 is not tested");
143+
return;
144+
}
145+
146+
}
147+
118148
/**
119149
* This test will fail if the arduino compile option are not taken into
120150
* account To do sa a bunch of defines are added to the command line and the
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "Arduino.h"
2+
3+
4+
5+
//The setup function is with spaces between the curly braces
6+
void setup(){ }
7+
8+
// The loop function is without content between curly braces
9+
void loop(){}
10+

0 commit comments

Comments
 (0)