aboutsummaryrefslogtreecommitdiff
path: root/java/src/test
diff options
context:
space:
mode:
authorkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-23 01:23:06 +0000
committerkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-23 01:23:06 +0000
commit35d2f017a7a685d700a8899d06d709cbffaaa885 (patch)
tree85112b072a34b483904b94d13720b2a003e69c4c /java/src/test
parent6e8b9e4a4a478c99a93925035b004a3829fd1e4f (diff)
downloadprotobuf-35d2f017a7a685d700a8899d06d709cbffaaa885.tar.gz
protobuf-35d2f017a7a685d700a8899d06d709cbffaaa885.tar.bz2
protobuf-35d2f017a7a685d700a8899d06d709cbffaaa885.zip
In Java's TextFormat, correcty concatenate adjacent string literals, as C++ does. Also fix a bug in handling of single-quoted strings.
Diffstat (limited to 'java/src/test')
-rw-r--r--java/src/test/java/com/google/protobuf/TextFormatTest.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/java/src/test/java/com/google/protobuf/TextFormatTest.java b/java/src/test/java/com/google/protobuf/TextFormatTest.java
index 3ea7b2cf..60bd800e 100644
--- a/java/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -196,12 +196,12 @@ public class TextFormatTest extends TestCase {
final FieldDescriptor optionalField =
TestAllTypes.getDescriptor().findFieldByName("optional_nested_message");
final Object value = NestedMessage.newBuilder().setBb(42).build();
-
+
assertEquals(
"optional_nested_message {\n bb: 42\n}\n",
TextFormat.printFieldToString(optionalField, value));
}
-
+
/**
* Helper to construct a ByteString from a String containing only 8-bit
* characters. The characters are converted directly to bytes, *not*
@@ -649,4 +649,10 @@ public class TextFormatTest extends TestCase {
TextFormat.merge("optional_string: \"" + longText + "\"", builder);
assertEquals(longText, builder.getOptionalString());
}
+
+ public void testParseAdjacentStringLiterals() throws Exception {
+ TestAllTypes.Builder builder = TestAllTypes.newBuilder();
+ TextFormat.merge("optional_string: \"foo\" 'corge' \"grault\"", builder);
+ assertEquals("foocorgegrault", builder.getOptionalString());
+ }
}