diff options
author | Marco Stornelli | 2019-04-12 16:36:10 +0000 |
---|---|---|
committer | Jonah Graham | 2019-04-13 18:28:30 +0000 |
commit | ef2468b390ffbd3950607116d09db504f014ea86 (patch) | |
tree | d60946f4566cbd5ba481c07a51b12faf024c4464 /core/org.eclipse.cdt.ui.tests | |
parent | 50daf5b6e84329a8f395612f74f55557ef4e1757 (diff) | |
download | org.eclipse.cdt-ef2468b390ffbd3950607116d09db504f014ea86.tar.gz org.eclipse.cdt-ef2468b390ffbd3950607116d09db504f014ea86.tar.xz org.eclipse.cdt-ef2468b390ffbd3950607116d09db504f014ea86.zip |
Bug 546391 - Fix on/off tags
Change-Id: If23ac8f7777c5088b892a31a543741c244dd1a4a
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/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java | 65 |
1 files changed, 65 insertions, 0 deletions
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 021b5a813ef..e73ffa8a746 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 @@ -4018,4 +4018,69 @@ public class CodeFormatterTest extends BaseUITestCase { public void testBoolInStructWithMacro_Bug397710() throws Exception { assertFormatterResult(); } + + ///* @formatter:off */ + //int xx2(){string s1="abc";string s2="def";} + ///* @formatter:on */ + // + ///* @formatter:on */ + //int xx(){string s1="abc";string s2="def";} + ///* @formatter:off */ + ///* @formatter:on */ + //int xx3(){string s1="abc";string s2="def";} + + ///* @formatter:off */ + //int xx2(){string s1="abc";string s2="def";} + ///* @formatter:on */ + // + ///* @formatter:on */ + //int xx() { + // string s1 = "abc"; + // string s2 = "def"; + //} + ///* @formatter:off */ + ///* @formatter:on */ + //int xx3() { + // string s1 = "abc"; + // string s2 = "def"; + //} + public void testOnOffTags1_Bug546391() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_COMMENT_TAG, true); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ON_TAG, "@formatter:on"); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_OFF_TAG, "@formatter:off"); + assertFormatterResult(); + } + + //int xx(){string s1="abc";string s2="def";} + ///* @formatter:off */ + + //int xx() { + // string s1 = "abc"; + // string s2 = "def"; + //} + ///* @formatter:off */ + public void testOnOffTags2_Bug546391() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_COMMENT_TAG, true); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ON_TAG, "@formatter:on"); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_OFF_TAG, "@formatter:off"); + assertFormatterResult(); + } + + ///* @formatter:off */ + //int xx(){string s1="abc";string s2="def";} + ///* @formatter:on + // * + // */ + + ///* @formatter:off */ + //int xx(){string s1="abc";string s2="def";} + ///* @formatter:on + // * + // */ + public void testOnOffTags3_Bug546391() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_COMMENT_TAG, true); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_ON_TAG, "@formatter:on"); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_OFF_TAG, "@formatter:off"); + assertFormatterResult(); + } } |