Skip to content

Commit 906c2f3

Browse files
committed
Add tests for constant propagation of StringBuffer.append(Object)
1 parent 5889579 commit 906c2f3

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
public class Test
2+
{
3+
public void testSuccess()
4+
{
5+
StringBuffer sb = new StringBuffer("abc");
6+
Integer i = new Integer(3);
7+
sb.append(i);
8+
assert sb.toString().equals("abc3");
9+
10+
sb.append((Object)"xyz");
11+
assert sb.toString().equals("abc3xyz");
12+
13+
sb.append((Object)null);
14+
assert sb.toString().equals("abc3xyznull");
15+
}
16+
17+
public void testNoPropagation(Object obj)
18+
{
19+
StringBuffer sb = new StringBuffer();
20+
assert obj.toString().equals("");
21+
}
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--function Test.testNoPropagation --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property 'java::Test.testNoPropagation:(Ljava/lang/Object;)V.assertion.1'
4+
^Generated [0-9]+ VCC\(s\), 1 remaining after simplification$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
^VERIFICATION FAILED$
8+
--
9+
--
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
Test.class
3+
--function Test.testSuccess --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
4+
^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
^VERIFICATION SUCCESSFUL$
8+
--
9+
--

0 commit comments

Comments
 (0)