diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-02-20 14:27:41 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-02-20 14:27:41 +0100 |
commit | af1544e7b81e8708c5fdee05a59328558a3030fe (patch) | |
tree | 0933eb39159b8cf714aab7fe5901d0515674d7c6 /java/test | |
parent | Simplification to Atomic usage (diff) | |
download | ice-af1544e7b81e8708c5fdee05a59328558a3030fe.tar.bz2 ice-af1544e7b81e8708c5fdee05a59328558a3030fe.tar.xz ice-af1544e7b81e8708c5fdee05a59328558a3030fe.zip |
Fix for ICE-6268, initialize enum, string and structs in Java/C#/Objective-C/JavaScript
Diffstat (limited to 'java/test')
-rw-r--r-- | java/test/src/main/java/test/Ice/defaultValue/AllTests.java | 45 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/defaultValue/Test.ice | 52 |
2 files changed, 92 insertions, 5 deletions
diff --git a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java index 0e2ac7fd606..4541cf21009 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java +++ b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java @@ -46,7 +46,7 @@ public class AllTests test(v.nc1 == test.Ice.defaultValue.Test.Nested.Color.red); test(v.nc2 == test.Ice.defaultValue.Test.Nested.Color.green); test(v.nc3 == test.Ice.defaultValue.Test.Nested.Color.blue); - test(v.noDefault == null); + test(v.noDefault.equals("")); test(v.zeroI == 0); test(v.zeroL == 0); test(v.zeroF == 0); @@ -84,7 +84,7 @@ public class AllTests test(v.f == 5.1F); test(v.d == 6.2); test(v.str.equals("foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007")); - test(v.noDefault == null); + test(v.noDefault.equals("")); test(v.zeroI == 0); test(v.zeroL == 0); test(v.zeroF == 0); @@ -110,7 +110,7 @@ public class AllTests test(v.nc1 == test.Ice.defaultValue.Test.Nested.Color.red); test(v.nc2 == test.Ice.defaultValue.Test.Nested.Color.green); test(v.nc3 == test.Ice.defaultValue.Test.Nested.Color.blue); - test(v.noDefault == null); + test(v.noDefault.equals("")); test(v.zeroI == 0); test(v.zeroL == 0); test(v.zeroF == 0); @@ -130,7 +130,7 @@ public class AllTests test(v.f == 5.1F); test(v.d == 6.2); test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007"); - test(v.noDefault == null); + test(v.noDefault.equals("")); test(v.zeroI == 0); test(v.zeroL == 0); test(v.zeroF == 0); @@ -150,7 +150,7 @@ public class AllTests test(v.f == 5.1F); test(v.d == 6.2); test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007"); - test(v.noDefault == null); + test(v.noDefault.equals("")); test(v.c1 == Color.red); test(v.c2 == Color.green); test(v.c3 == Color.blue); @@ -166,5 +166,40 @@ public class AllTests } out.println("ok"); + + out.write("testing default constructor... "); + out.flush(); + { + test.Ice.defaultValue.Test.StructNoDefaults v = new test.Ice.defaultValue.Test.StructNoDefaults(); + test(v.bo == false); + test(v.b == 0); + test(v.s == 0); + test(v.i == 0); + test(v.l == 0); + test(v.f == 0.0); + test(v.d == 0.0); + test(v.str.equals("")); + test(v.c1 == test.Ice.defaultValue.Test.Color.red); + test(v.bs == null); + test(v.is == null); + test(v.st != null); + test(v.dict == null); + + test.Ice.defaultValue.Test.ExceptionNoDefaults e = new test.Ice.defaultValue.Test.ExceptionNoDefaults(); + test(e.str.equals("")); + test(e.c1 == test.Ice.defaultValue.Test.Color.red); + test(e.bs == null); + test(e.st != null); + test(e.dict == null); + + test.Ice.defaultValue.Test.ClassNoDefaults cl = new test.Ice.defaultValue.Test.ClassNoDefaults(); + test(cl.str.equals("")); + test(cl.c1 == test.Ice.defaultValue.Test.Color.red); + test(cl.bs == null); + test(cl.st != null); + test(cl.dict == null); + } + + out.println("ok"); } } diff --git a/java/test/src/main/java/test/Ice/defaultValue/Test.ice b/java/test/src/main/java/test/Ice/defaultValue/Test.ice index f3b38bd08b2..1978cf9c9e1 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/Test.ice +++ b/java/test/src/main/java/test/Ice/defaultValue/Test.ice @@ -153,4 +153,56 @@ exception DerivedEx extends BaseEx Nested::Color nc3 = ConstNestedColor3; }; +sequence<byte> ByteSeq; +sequence<int> IntSeq; +dictionary<int, string> IntStringDict; + +struct InnerStruct +{ + int a; +}; + +struct StructNoDefaults +{ + bool bo; + byte b; + short s; + int i; + long l; + float f; + double d; + string str; + Color c1; + ByteSeq bs; + IntSeq is; + InnerStruct st; + IntStringDict dict; +}; + +exception ExceptionNoDefaultsBase +{ + string str; + Color c1; + ByteSeq bs; +}; + +exception ExceptionNoDefaults extends ExceptionNoDefaultsBase +{ + InnerStruct st; + IntStringDict dict; +}; + +class ClassNoDefaultsBase +{ + string str; + Color c1; + ByteSeq bs; +}; + +class ClassNoDefaults extends ClassNoDefaultsBase +{ + InnerStruct st; + IntStringDict dict; +}; + }; |