Skip to content

Commit 3da291c

Browse files
author
Joel Allred
authored
Merge pull request #4785 from diffblue/string-format-percent-and-newline
Tests for percent and newline format specifiers TG-7657
2 parents a65c197 + e5dd6b5 commit 3da291c

10 files changed

+86
-0
lines changed
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
public class Test {
2+
public static String percent() {
3+
String u = String.format("%s %% %s", "foo", "bar");
4+
if (u.equals("foo % bar"))
5+
assert(false);
6+
else
7+
assert(false); // unreachable
8+
return u;
9+
}
10+
11+
public static String percentLength() {
12+
String u = String.format("%s %% %s", "foo", "bar");
13+
if (u.length() == 9)
14+
assert(false);
15+
else
16+
assert(false); // unreachable
17+
return u;
18+
}
19+
20+
public static String newline() {
21+
String u = String.format("%s %n %s", "foo", "bar");
22+
if (u.equals("foo \n bar"))
23+
assert(false);
24+
else
25+
assert(false); // unreachable
26+
return u;
27+
}
28+
29+
public static String newlineLength() {
30+
String u = String.format("%s %% %s", "foo", "bar");
31+
if (u.length() == 9)
32+
assert(false);
33+
else
34+
assert(false); // unreachable
35+
return u;
36+
}
37+
38+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.newline --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.newline:()Ljava/lang/String;.assertion.1"
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 23 assertion at file Test.java .*: FAILURE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.newlineLength --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.newlineLength:()Ljava/lang/String;.assertion.1"
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 32 assertion at file Test.java .*: FAILURE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--function Test.newlineLength --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.newlineLength:()Ljava/lang/String;.assertion.2"
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
line 34 assertion at file Test.java .*: SUCCESS
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--function Test.newline --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.newline:()Ljava/lang/String;.assertion.2"
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
line 25 assertion at file Test.java .*: SUCCESS
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.percent --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.percent:()Ljava/lang/String;.assertion.1"
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 5 assertion at file Test.java .*: FAILURE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--function Test.percentLength --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.percentLength:()Ljava/lang/String;.assertion.1"
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
line 14 assertion at file Test.java .*: FAILURE
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--function Test.percentLength --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.percentLength:()Ljava/lang/String;.assertion.2"
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
line 16 assertion at file Test.java .*: SUCCESS
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE symex-driven-lazy-loading-expected-failure
2+
Test.class
3+
--function Test.percent --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar` --property "java::Test.percent:()Ljava/lang/String;.assertion.2"
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
line 7 assertion at file Test.java .*: SUCCESS

0 commit comments

Comments
 (0)