summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-03-08 13:46:55 +0100
committerJose <jose@zeroc.com>2016-03-08 13:46:55 +0100
commit2bd402833bfdb54c1940dd0038be8af05d6f5e6f (patch)
treeeb7be3853dc45452397b730e586434f6e859efb3 /python
parentWindows fixes for icegriddb/icestormdb (diff)
downloadice-2bd402833bfdb54c1940dd0038be8af05d6f5e6f.tar.bz2
ice-2bd402833bfdb54c1940dd0038be8af05d6f5e6f.tar.xz
ice-2bd402833bfdb54c1940dd0038be8af05d6f5e6f.zip
ICE-6991 - Add support for unicode escape sequences
Diffstat (limited to 'python')
-rwxr-xr-xpython/test/Ice/operations/ServerAMD.py6
-rw-r--r--python/test/Ice/operations/Test.ice67
-rw-r--r--python/test/Ice/operations/TestAMD.ice67
-rw-r--r--python/test/Ice/operations/TestI.py6
-rw-r--r--python/test/Ice/operations/Twoways.py80
5 files changed, 226 insertions, 0 deletions
diff --git a/python/test/Ice/operations/ServerAMD.py b/python/test/Ice/operations/ServerAMD.py
index 39e51b08c77..3561221335a 100755
--- a/python/test/Ice/operations/ServerAMD.py
+++ b/python/test/Ice/operations/ServerAMD.py
@@ -403,6 +403,12 @@ class MyDerivedClassI(Test.MyDerivedClass):
def opMyStruct1_async(self, cb, value, current=None):
return cb.ice_response(value)
+ def opStringLiterals_async(self, cb, current=None):
+ return cb.ice_response([
+ Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10,
+ Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, Test.sw10,
+ Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5,
+ Test.su0, Test.su1, Test.su2])
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp")
diff --git a/python/test/Ice/operations/Test.ice b/python/test/Ice/operations/Test.ice
index f2a46f54e9b..7f5ec510834 100644
--- a/python/test/Ice/operations/Test.ice
+++ b/python/test/Ice/operations/Test.ice
@@ -246,6 +246,8 @@ class MyClass
ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1);
StringS opStringS2(StringS stringS);
ByteBoolD opByteBoolD2(ByteBoolD byteBoolD);
+
+ StringS opStringLiterals();
};
struct MyStruct1
@@ -269,4 +271,69 @@ class MyDerivedClass extends MyClass
MyStruct1 opMyStruct1(MyStruct1 opMyStruct1);
};
+//
+// String literals
+//
+
+const string s0 = "\u005c"; // backslash
+const string s1 = "\u0041"; // A
+const string s2 = "\u0049\u0063\u0065"; // Ice
+const string s3 = "\u004121"; // A21
+const string s4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string s5 = "\u00FF"; // ÿ
+const string s6 = "\u03FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string s7 = "\u05F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string s8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string s9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string s10 = "\u0DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+const string sw0 = "\U0000005c"; // backslash
+const string sw1 = "\U00000041"; // A
+const string sw2 = "\U00000049\U00000063\U00000065"; // Ice
+const string sw3 = "\U0000004121"; // A21
+const string sw4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string sw5 = "\U000000FF"; // ÿ
+const string sw6 = "\U000003FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string sw7 = "\U000005F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string sw8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string sw9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+/**
+\' single quote byte 0x27 in ASCII encoding
+\" double quote byte 0x22 in ASCII encoding
+\? question mark byte 0x3f in ASCII encoding
+\\ backslash byte 0x5c in ASCII encoding
+\a audible bell byte 0x07 in ASCII encoding
+\b backspace byte 0x08 in ASCII encoding
+\f form feed - new page byte 0x0c in ASCII encoding
+\n line feed - new line byte 0x0a in ASCII encoding
+\r carriage return byte 0x0d in ASCII encoding
+\t horizontal tab byte 0x09 in ASCII encoding
+\v vertical tab byte 0x0b in ASCII encoding
+**/
+
+const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v";
+const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b";
+const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b";
+
+const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */
+const string ss4 = "\\\u0041\\"; /* \A\ */
+const string ss5 = "\\u0041\\"; /* \u0041\ */
+
+//
+// ÿ - Unicode Character 'LATIN SMALL LETTER Y WITH DIAERESIS' (U+00FF)
+// Ā - Unicode Character 'LATIN CAPITAL LETTER A WITH MACRON' (U+0100)
+// ἀ - Unicode Character 'GREEK SMALL LETTER ALPHA WITH PSILI' (U+1F00)
+// 𐆔 - Unicode Character 'ROMAN DIMIDIA SEXTULA SIGN' (U+10194)
+// 𐅪 - Unicode Character 'GREEK ACROPHONIC THESPIAN ONE HUNDRED' (U+1016A)
+// 𐆘 - Unicode Character 'ROMAN SESTERTIUS SIGN' (U+10198)
+// 🍀 - Unicode Character 'FOUR LEAF CLOVER' (U+1F340)
+// 🍁 - Unicode Character 'MAPLE LEAF' (U+1F341)
+// 🍂 - Unicode Character 'FALLEN LEAF' (U+1F342)
+// 🍃 - Unicode Character 'LEAF FLUTTERING IN WIND' (U+1F343)
+const string su0 = "ÿĀἀ𐆔𐅪𐆘🍀🍁🍂🍃";
+const string su1 = "\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+const string su2 = "\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+
};
diff --git a/python/test/Ice/operations/TestAMD.ice b/python/test/Ice/operations/TestAMD.ice
index 022dca4bba4..ba567612d60 100644
--- a/python/test/Ice/operations/TestAMD.ice
+++ b/python/test/Ice/operations/TestAMD.ice
@@ -244,6 +244,8 @@ dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD;
ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1);
StringS opStringS2(StringS stringS);
ByteBoolD opByteBoolD2(ByteBoolD byteBoolD);
+
+ StringS opStringLiterals();
};
struct MyStruct1
@@ -267,4 +269,69 @@ class MyClass1
MyStruct1 opMyStruct1(MyStruct1 opMyStruct1);
};
+//
+// String literals
+//
+
+const string s0 = "\u005c"; // backslash
+const string s1 = "\u0041"; // A
+const string s2 = "\u0049\u0063\u0065"; // Ice
+const string s3 = "\u004121"; // A21
+const string s4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string s5 = "\u00FF"; // ÿ
+const string s6 = "\u03FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string s7 = "\u05F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string s8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string s9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string s10 = "\u0DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+const string sw0 = "\U0000005c"; // backslash
+const string sw1 = "\U00000041"; // A
+const string sw2 = "\U00000049\U00000063\U00000065"; // Ice
+const string sw3 = "\U0000004121"; // A21
+const string sw4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string sw5 = "\U000000FF"; // ÿ
+const string sw6 = "\U000003FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string sw7 = "\U000005F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string sw8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string sw9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+/**
+\' single quote byte 0x27 in ASCII encoding
+\" double quote byte 0x22 in ASCII encoding
+\? question mark byte 0x3f in ASCII encoding
+\\ backslash byte 0x5c in ASCII encoding
+\a audible bell byte 0x07 in ASCII encoding
+\b backspace byte 0x08 in ASCII encoding
+\f form feed - new page byte 0x0c in ASCII encoding
+\n line feed - new line byte 0x0a in ASCII encoding
+\r carriage return byte 0x0d in ASCII encoding
+\t horizontal tab byte 0x09 in ASCII encoding
+\v vertical tab byte 0x0b in ASCII encoding
+**/
+
+const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v";
+const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b";
+const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b";
+
+const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */
+const string ss4 = "\\\u0041\\"; /* \A\ */
+const string ss5 = "\\u0041\\"; /* \u0041\ */
+
+//
+// ÿ - Unicode Character 'LATIN SMALL LETTER Y WITH DIAERESIS' (U+00FF)
+// Ā - Unicode Character 'LATIN CAPITAL LETTER A WITH MACRON' (U+0100)
+// ἀ - Unicode Character 'GREEK SMALL LETTER ALPHA WITH PSILI' (U+1F00)
+// 𐆔 - Unicode Character 'ROMAN DIMIDIA SEXTULA SIGN' (U+10194)
+// 𐅪 - Unicode Character 'GREEK ACROPHONIC THESPIAN ONE HUNDRED' (U+1016A)
+// 𐆘 - Unicode Character 'ROMAN SESTERTIUS SIGN' (U+10198)
+// 🍀 - Unicode Character 'FOUR LEAF CLOVER' (U+1F340)
+// 🍁 - Unicode Character 'MAPLE LEAF' (U+1F341)
+// 🍂 - Unicode Character 'FALLEN LEAF' (U+1F342)
+// 🍃 - Unicode Character 'LEAF FLUTTERING IN WIND' (U+1F343)
+const string su0 = "ÿĀἀ𐆔𐅪𐆘🍀🍁🍂🍃";
+const string su1 = "\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+const string su2 = "\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+
};
diff --git a/python/test/Ice/operations/TestI.py b/python/test/Ice/operations/TestI.py
index 5035d00cb3a..6700fbfa26e 100644
--- a/python/test/Ice/operations/TestI.py
+++ b/python/test/Ice/operations/TestI.py
@@ -361,5 +361,11 @@ class MyDerivedClassI(Test.MyDerivedClass):
def opMyStruct1(self, value, current=None):
return value
+
+ def opStringLiterals(self, current=None):
+ return [Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10,
+ Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, Test.sw10,
+ Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5,
+ Test.su0, Test.su1, Test.su2]
\ No newline at end of file
diff --git a/python/test/Ice/operations/Twoways.py b/python/test/Ice/operations/Twoways.py
index ed0d9e3ae3e..04dcee69f1a 100644
--- a/python/test/Ice/operations/Twoways.py
+++ b/python/test/Ice/operations/Twoways.py
@@ -14,6 +14,86 @@ def test(b):
raise RuntimeError('test assertion failed')
def twoways(communicator, p):
+
+ literals = p.opStringLiterals();
+
+ test(Test.s0 == "\\" and
+ Test.s0 == Test.sw0 and
+ Test.s0 == literals[0] and
+ Test.s0 == literals[11]);
+
+ test(Test.s1 == "A" and
+ Test.s1 == Test.sw1 and
+ Test.s1 == literals[1] and
+ Test.s1 == literals[12]);
+
+ test(Test.s2 == "Ice" and
+ Test.s2 == Test.sw2 and
+ Test.s2 == literals[2] and
+ Test.s2 == literals[13]);
+
+ test(Test.s3 == "A21" and
+ Test.s3 == Test.sw3 and
+ Test.s3 == literals[3] and
+ Test.s3 == literals[14]);
+
+ test(Test.s4 == "\\u0041 \\U00000041" and
+ Test.s4 == Test.sw4 and
+ Test.s4 == literals[4] and
+ Test.s4 == literals[15]);
+
+ test(Test.s5 == "\xc3\xbf" and
+ Test.s5 == Test.sw5 and
+ Test.s5 == literals[5] and
+ Test.s5 == literals[16]);
+
+ test(Test.s6 == "\xcf\xbf" and
+ Test.s6 == Test.sw6 and
+ Test.s6 == literals[6] and
+ Test.s6 == literals[17]);
+
+ test(Test.s7 == "\xd7\xb0" and
+ Test.s7 == Test.sw7 and
+ Test.s7 == literals[7] and
+ Test.s7 == literals[18]);
+
+ test(Test.s8 == "\xf0\x90\x80\x80" and
+ Test.s8 == Test.sw8 and
+ Test.s8 == literals[8] and
+ Test.s8 == literals[19]);
+
+ test(Test.s9 == "\xf0\x9f\x8d\x8c" and
+ Test.s9 == Test.sw9 and
+ Test.s9 == literals[9] and
+ Test.s9 == literals[20]);
+
+ test(Test.s10 == "\xe0\xb6\xa7" and
+ Test.s10 == Test.sw10 and
+ Test.s10 == literals[10] and
+ Test.s10 == literals[21]);
+
+ test(Test.ss0 == "\'\"\x3f\\\a\b\f\n\r\t\v" and
+ Test.ss0 == Test.ss1 and
+ Test.ss0 == Test.ss2 and
+ Test.ss0 == literals[22] and
+ Test.ss0 == literals[23] and
+ Test.ss0 == literals[24]);
+
+ test(Test.ss3 == "\\\\U\\u\\" and
+ Test.ss3 == literals[25]);
+
+ test(Test.ss4 == "\\A\\" and
+ Test.ss4 == literals[26]);
+
+ test(Test.ss5 == "\\u0041\\" and
+ Test.ss5 == literals[27]);
+
+ test(Test.su0 == Test.su1 and
+ Test.su0 == Test.su2 and
+ Test.su0 == literals[28] and
+ Test.su0 == literals[29] and
+ Test.su0 == literals[30]);
+
#
# ice_ping
#