IDEA-82398 Reformat code broken for a string going past right margin

1. Don't wrap string which length is equal to the right margin;
2. Corresponding test is added;
This commit is contained in:
Denis.Zhdanov
2012-03-11 11:42:37 +04:00
parent 1e8578698b
commit d5f2eca5f5
2 changed files with 15 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -152,6 +152,18 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
doClassTest(text, text);
}
public void testWrapCompoundStringLiteralThatEndsAtRightMargin() {
// Inspired by IDEA-82398
getSettings().getRootSettings().RIGHT_MARGIN = 30;
getSettings().getRootSettings().getCommonSettings(JavaLanguage.INSTANCE).WRAP_LONG_LINES = true;
final String text = "class Test {\n" +
" String s = \"first line \" +\n" +
" +\"second line\";\n" +
"}";
doTextTest(text, text);
}
public void testWrapLongLine() {
// Inspired by IDEA-55782
getSettings().getRootSettings().RIGHT_MARGIN = 50;