-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fixes and improvments to TernaryPushdownStrings (issue #236)
- Loading branch information
1 parent
6784650
commit b4b4cd5
Showing
2 changed files
with
100 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/il/org/spartan/spartanizer/wrings/Issue236Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package il.org.spartan.spartanizer.wrings; | ||
|
||
import static il.org.spartan.spartanizer.wrings.TrimmerTestsUtils.*; | ||
|
||
import org.junit.*; | ||
import org.junit.runners.*; | ||
|
||
/** Unit tests for {@link TernaryPusdownStrings} | ||
* @author Niv Shalmon | ||
* @since 2016 */ | ||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) // | ||
@SuppressWarnings({ "static-method", "javadoc" }) // | ||
public class Issue236Test { | ||
@Test public void issue236_01() { | ||
trimmingOf("b ? \"a long string\" : \"another \"+\"long\"+\" string\"")// | ||
.gives("(b ? \"a long\" : \"another \"+\"long\"+\"\") +\" string\"") | ||
.gives("(b ? \"a long\" : \"another \"+\"long\") +\" string\"") | ||
.gives("((b ? \"a \" : \"another \"+\"\") +\"long\")+\" string\"") | ||
.gives("(b ? \"a \" : \"another \"+\"\") +\"long\"+\" string\"") | ||
.gives("(b ? \"a \" : \"another \") +\"long\"+\" string\"") | ||
.gives("((b ? \"a\" : \"another\") + \" \") +\"long\"+\" string\"") | ||
.gives("(b ? \"a\" : \"another\") + \" \" +\"long\"+\" string\"") | ||
.stays(); | ||
} | ||
|
||
@Test public void issue236_02() { | ||
trimmingOf("b? \"something\" : \"something\"+\" else\"") | ||
.gives("\"something\" + (b? \"\" : \"\"+\" else\")") | ||
.gives("\"something\" + (b? \"\" : \" else\")").stays(); | ||
} | ||
|
||
} |