Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Stornelli2019-02-24 09:04:03 +0000
committerWilliam Riley2019-03-04 10:41:56 +0000
commit04cc77cf2a7439451f6bb6660f4ca3369e7bee13 (patch)
tree93eeff84dfd5669b49494d657068a75655213462 /core/org.eclipse.cdt.ui.tests
parent2d29c1683ec9c1f7e79e6b9b3ea92e6ccbcc7f2d (diff)
downloadorg.eclipse.cdt-04cc77cf2a7439451f6bb6660f4ca3369e7bee13.tar.gz
org.eclipse.cdt-04cc77cf2a7439451f6bb6660f4ca3369e7bee13.tar.xz
org.eclipse.cdt-04cc77cf2a7439451f6bb6660f4ca3369e7bee13.zip
Bug 278903 - Do not format any code in inactive regions
Not active regions of code may not be formatted. Change-Id: I3796bd84bf4101cec55ef9f35f9703e8bc46092e Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF2
-rw-r--r--core/org.eclipse.cdt.ui.tests/pom.xml2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java44
4 files changed, 43 insertions, 9 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF
index f8f9a0ed705..dd754c7084f 100644
--- a/core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.cdt.ui.tests
Bundle-SymbolicName: org.eclipse.cdt.ui.tests; singleton:=true
-Bundle-Version: 5.5.100.qualifier
+Bundle-Version: 5.5.200.qualifier
Bundle-Activator: org.eclipse.cdt.ui.testplugin.CTestPlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.ui.testplugin,
diff --git a/core/org.eclipse.cdt.ui.tests/pom.xml b/core/org.eclipse.cdt.ui.tests/pom.xml
index ea85659a582..addb737bdd3 100644
--- a/core/org.eclipse.cdt.ui.tests/pom.xml
+++ b/core/org.eclipse.cdt.ui.tests/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>5.5.100-SNAPSHOT</version>
+ <version>5.5.200-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
index 5e98e78c616..3fb644c93a3 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/sample/After.cpp
@@ -26,8 +26,8 @@ const SimpleStruct simpleStruct = { 1, "mySimple", 0.1232 };
const SimpleStruct array[] = { { SIZEOF(simpleStruct, num),
#if FOO
- "foo"
-# else
+ "foo"
+ # else
"bar"
#endif
, 0.5 }, { SIZEOF(simpleStruct, floatNum), "name", 1.1 } };
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
index 45f8255701f..6281ffe14fd 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
@@ -527,7 +527,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//
//const SimpleStruct array[] = { { SIZEOF(simpleStruct, num),
//#if FOO
- // "foo"
+ //"foo"
//#else
// "bar"
//#endif
@@ -1799,10 +1799,10 @@ public class CodeFormatterTest extends BaseUITestCase {
// foo ARGS;
// CALL;
//#if X
- // if (1)
- // {
- // t = 1;
- // }
+ // if (1)
+ // {
+ // t = 1;
+ // }
//#endif
//}
public void testMacroAsFunctionArguments_Bug253039() throws Exception {
@@ -3656,4 +3656,38 @@ public class CodeFormatterTest extends BaseUITestCase {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_OFF_TAG, "@formatter:off");
assertFormatterResult();
}
+
+ //int code_before_inactive;
+ //#if 0
+ // void this_line_intentionally_indented() {
+ // int x;
+ // }
+ //#endif
+ //int code_after_inactive;
+
+ //int code_before_inactive;
+ //#if 0
+ // void this_line_intentionally_indented() {
+ // int x;
+ // }
+ //#endif
+ //int code_after_inactive;
+ public void testDoeNotFormatInactiveCode() throws Exception {
+ assertFormatterResult();
+ }
+
+ //#if 0
+ // void this_line_intentionally_indented() {
+ // int x;
+ // }
+ //#endif
+
+ //#if 0
+ // void this_line_intentionally_indented() {
+ // int x;
+ // }
+ //#endif
+ public void testDoeNotFormatInactiveCodeEntireFile() throws Exception {
+ assertFormatterResult();
+ }
}

Back to the top