summaryrefslogtreecommitdiff
path: root/js/test/Ice/defaultValue/Client.js
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2015-02-20 14:27:41 +0100
committerBenoit Foucher <benoit@zeroc.com>2015-02-20 14:27:41 +0100
commitaf1544e7b81e8708c5fdee05a59328558a3030fe (patch)
tree0933eb39159b8cf714aab7fe5901d0515674d7c6 /js/test/Ice/defaultValue/Client.js
parentSimplification to Atomic usage (diff)
downloadice-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 'js/test/Ice/defaultValue/Client.js')
-rw-r--r--js/test/Ice/defaultValue/Client.js58
1 files changed, 46 insertions, 12 deletions
diff --git a/js/test/Ice/defaultValue/Client.js b/js/test/Ice/defaultValue/Client.js
index 02c43fd827e..9721990229a 100644
--- a/js/test/Ice/defaultValue/Client.js
+++ b/js/test/Ice/defaultValue/Client.js
@@ -31,7 +31,7 @@
}
}
};
-
+
Promise.try(
function()
{
@@ -52,14 +52,14 @@
test(v.nc1 === Test.Nested.Color.red);
test(v.nc2 === Test.Nested.Color.green);
test(v.nc3 === Test.Nested.Color.blue);
- test(v.noDefault === null);
+ test(v.noDefault === "");
test(v.zeroI === 0);
test(v.zeroL.equals(new Ice.Long(0, 0)));
test(v.zeroF === 0);
test(v.zeroDotF === 0);
test(v.zeroD === 0);
test(v.zeroDotD === 0);
-
+
v = new Test.Struct2();
test(v.boolTrue === Test.ConstBool);
test(v.b === Test.ConstByte);
@@ -75,7 +75,7 @@
test(v.nc1 === Test.ConstNestedColor1);
test(v.nc2 === Test.ConstNestedColor2);
test(v.nc3 === Test.ConstNestedColor3);
-
+
v = new Test.Base();
test(!v.boolFalse);
test(v.boolTrue);
@@ -86,14 +86,14 @@
test(v.f === 5.1);
test(v.d === 6.2);
test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?");
- test(v.noDefault === null);
+ test(v.noDefault === "");
test(v.zeroI === 0);
test(v.zeroL.equals(new Ice.Long(0, 0)));
test(v.zeroF === 0);
test(v.zeroDotF === 0);
test(v.zeroD === 0);
test(v.zeroDotD === 0);
-
+
v = new Test.Derived();
test(!v.boolFalse);
test(v.boolTrue);
@@ -110,14 +110,14 @@
test(v.nc1 === Test.Nested.Color.red);
test(v.nc2 === Test.Nested.Color.green);
test(v.nc3 === Test.Nested.Color.blue);
- test(v.noDefault === null);
+ test(v.noDefault === "");
test(v.zeroI === 0);
test(v.zeroL.equals(new Ice.Long(0, 0)));
test(v.zeroF === 0);
test(v.zeroDotF === 0);
test(v.zeroD === 0);
test(v.zeroDotD === 0);
-
+
v = new Test.BaseEx();
test(!v.boolFalse);
test(v.boolTrue);
@@ -128,14 +128,14 @@
test(v.f === 5.1);
test(v.d === 6.2);
test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?");
- test(v.noDefault === null);
+ test(v.noDefault === "");
test(v.zeroI === 0);
test(v.zeroL.equals(new Ice.Long(0, 0)));
test(v.zeroF === 0);
test(v.zeroDotF === 0);
test(v.zeroD === 0);
test(v.zeroDotD === 0);
-
+
v = new Test.DerivedEx();
test(!v.boolFalse);
test(v.boolTrue);
@@ -146,7 +146,7 @@
test(v.f === 5.1);
test(v.d === 6.2);
test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?");
- test(v.noDefault === null);
+ test(v.noDefault === "");
test(v.c1 === Test.Color.red);
test(v.c2 === Test.Color.green);
test(v.c3 === Test.Color.blue);
@@ -159,7 +159,41 @@
test(v.zeroDotF === 0);
test(v.zeroD === 0);
test(v.zeroDotD === 0);
-
+
+ out.writeLine("ok");
+
+
+ out.write("testing default constructor... ");
+
+ var v2 = new Test.StructNoDefaults();
+ test(v2.bo == false);
+ test(v2.b == 0);
+ test(v2.s == 0);
+ test(v2.i == 0);
+ test(v2.l == 0);
+ test(v2.f == 0.0);
+ test(v2.d == 0.0);
+ test(v2.str == "");
+ test(v2.c1 == Test.Color.red);
+ test(v2.bs == null);
+ test(v2.is == null);
+ test(v2.st != null && v2.st instanceof Test.InnerStruct);
+ test(v2.dict == null);
+
+ var e = new Test.ExceptionNoDefaults();
+ test(e.str == "");
+ test(e.c1 == Test.Color.red);
+ test(e.bs == null);
+ test(e.st != null && e.st instanceof Test.InnerStruct);
+ test(e.dict == null);
+
+ var cl = new Test.ClassNoDefaults();
+ test(cl.str == "");
+ test(cl.c1 == Test.Color.red);
+ test(cl.bs == null);
+ test(cl.st != null && cl.st instanceof Test.InnerStruct);
+ test(cl.dict == null);
+
out.writeLine("ok");
}
).then(