diff options
author | Jose <jose@zeroc.com> | 2019-09-03 16:44:36 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-09-03 16:44:36 +0200 |
commit | 860cd6940fc075f1b30d07b138f410d230ac0e14 (patch) | |
tree | 93c0c2141615b05aedd71e910ecb008a9c30c7aa /js | |
parent | Fix bogus doc comments generated by slice2cs - Close #500 (diff) | |
download | ice-860cd6940fc075f1b30d07b138f410d230ac0e14.tar.bz2 ice-860cd6940fc075f1b30d07b138f410d230ac0e14.tar.xz ice-860cd6940fc075f1b30d07b138f410d230ac0e14.zip |
Fixes for slice2py forward declarations - Close #490
Diffstat (limited to 'js')
-rw-r--r-- | js/test/Ice/objects/Client.js | 4 | ||||
-rw-r--r-- | js/test/Ice/objects/Server.js | 8 | ||||
-rw-r--r-- | js/test/typescript/Ice/objects/Client.ts | 49 | ||||
-rw-r--r-- | js/test/typescript/Ice/objects/Forward.ice | 20 | ||||
-rw-r--r-- | js/test/typescript/Ice/objects/InitialI.ts | 27 | ||||
-rw-r--r-- | js/test/typescript/Ice/objects/Server.ts | 8 | ||||
-rw-r--r-- | js/test/typescript/Ice/objects/Test.ice | 33 |
7 files changed, 147 insertions, 2 deletions
diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js index 9e214a1a4c4..0f5e5cb730b 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -471,8 +471,10 @@ test(f11.name == "F11"); test(f12.name == "F12"); - const [f21, f22] = await initial.opF2(Test.F2Prx.uncheckedCast(communicator.stringToProxy("F21"))); + const [f21, f22] = await initial.opF2( + Test.F2Prx.uncheckedCast(communicator.stringToProxy("F21:" + this.getTestEndpoint()))); test(f21.ice_getIdentity().name == "F21"); + await f21.op(); test(f22.ice_getIdentity().name == "F22"); const hasF3 = await initial.hasF3(); diff --git a/js/test/Ice/objects/Server.js b/js/test/Ice/objects/Server.js index fa55ce23596..300796085b4 100644 --- a/js/test/Ice/objects/Server.js +++ b/js/test/Ice/objects/Server.js @@ -18,6 +18,13 @@ } } + class F2I extends Test.F2 + { + op(current) + { + } + } + class Server extends TestHelper { async run(args) @@ -33,6 +40,7 @@ echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint())); const adapter = await communicator.createObjectAdapter(""); adapter.add(new InitialI(communicator), Ice.stringToIdentity("initial")); + adapter.add(new F2I(), Ice.stringToIdentity("F21")); adapter.add(new UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); diff --git a/js/test/typescript/Ice/objects/Client.ts b/js/test/typescript/Ice/objects/Client.ts index 9b0ef643def..14e420cf022 100644 --- a/js/test/typescript/Ice/objects/Client.ts +++ b/js/test/typescript/Ice/objects/Client.ts @@ -451,6 +451,55 @@ export class Client extends TestHelper test(communicator.getValueFactoryManager().find("TestOF") !== null); out.writeLine("ok"); + out.write("testing class containing complex dictionary... "); + { + const m = new Test.M(); + m.v = new Test.LMap(); + const k1 = new Test.StructKey(1, "1"); + m.v.set(k1, new Test.L("one")); + const k2 = new Test.StructKey(2, "2"); + m.v.set(k2, new Test.L("two")); + + const [m1, m2] = await initial.opM(m); + + test(m1.v.size == 2); + test(m2.v.size == 2); + + test(m1.v.get(k1).data == "one"); + test(m2.v.get(k1).data == "one"); + + test(m1.v.get(k2).data == "two"); + test(m2.v.get(k2).data == "two"); + + } + out.writeLine("ok"); + + out.write("testing forward declarations... "); + { + const [f11, f12] = await initial.opF1(new Test.F1("F11")); + test(f11.name == "F11"); + test(f12.name == "F12"); + + const [f21, f22] = await initial.opF2( + Test.F2Prx.uncheckedCast(communicator.stringToProxy("F21:" + this.getTestEndpoint()))); + test(f21.ice_getIdentity().name == "F21"); + await f21.op(); + test(f22.ice_getIdentity().name == "F22"); + + const hasF3 = await initial.hasF3(); + if(hasF3) + { + const [f31, f32] = await initial.opF3( + new Test.F3(new Test.F1("F11"), Test.F2Prx.uncheckedCast(communicator.stringToProxy("F21")))); + test(f31.f1.name == "F11"); + test(f31.f2.ice_getIdentity().name == "F21"); + + test(f32.f1.name == "F12"); + test(f32.f2.ice_getIdentity().name == "F22"); + } + } + out.writeLine("ok"); + await initial.shutdown(); } diff --git a/js/test/typescript/Ice/objects/Forward.ice b/js/test/typescript/Ice/objects/Forward.ice new file mode 100644 index 00000000000..5cc93e83b4a --- /dev/null +++ b/js/test/typescript/Ice/objects/Forward.ice @@ -0,0 +1,20 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +#pragma once + +module Test +{ + +class F1 +{ + string name; +} + +interface F2 +{ + void op(); +} + +}; diff --git a/js/test/typescript/Ice/objects/InitialI.ts b/js/test/typescript/Ice/objects/InitialI.ts index 5c3cf1b48f6..bae2e621d7d 100644 --- a/js/test/typescript/Ice/objects/InitialI.ts +++ b/js/test/typescript/Ice/objects/InitialI.ts @@ -315,6 +315,33 @@ export class InitialI extends Test.Initial throw new Test.Inner.Sub.Ex("Inner::Sub::Ex"); } + opM(v1:Test.M, current:Ice.Current):[Test.M, Test.M] + { + return [v1, v1]; + } + + opF1(f11:Test.F1, current:Ice.Current):[Test.F1, Test.F1] + { + return [f11, new Test.F1("F12")]; + } + + opF2(f21:Test.F2Prx, current:Ice.Current):[Test.F2Prx, Test.F2Prx] + { + return [f21, Test.F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22"))]; + } + + opF3(f31:Test.F3, current:Ice.Current):[Test.F3, Test.F3] + { + return [f31, + new Test.F3(new Test.F1("F12"), + Test.F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22")))]; + } + + hasF3(current:Ice.Current):boolean + { + return true; + } + shutdown(current:Ice.Current):void { current.adapter.getCommunicator().shutdown(); diff --git a/js/test/typescript/Ice/objects/Server.ts b/js/test/typescript/Ice/objects/Server.ts index dc365a1080e..3b65b1e318c 100644 --- a/js/test/typescript/Ice/objects/Server.ts +++ b/js/test/typescript/Ice/objects/Server.ts @@ -17,6 +17,13 @@ class UnexpectedObjectExceptionTestI extends Test.UnexpectedObjectExceptionTest } } +class F2I extends Test.F2 +{ + op(current:Ice.Current):void + { + } +} + export class Server extends TestHelper { async run(args:string[]) @@ -32,6 +39,7 @@ export class Server extends TestHelper echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint())); const adapter = await communicator.createObjectAdapter(""); adapter.add(new InitialI(communicator), Ice.stringToIdentity("initial")); + adapter.add(new F2I(), Ice.stringToIdentity("F21")); adapter.add(new UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); diff --git a/js/test/typescript/Ice/objects/Test.ice b/js/test/typescript/Ice/objects/Test.ice index 5069f1e8936..b82558f93f5 100644 --- a/js/test/typescript/Ice/objects/Test.ice +++ b/js/test/typescript/Ice/objects/Test.ice @@ -4,7 +4,8 @@ #pragma once -[["suppress-warning:deprecated", "js:es6-module"]] // For classes with operations +[["suppress-warning:deprecated", // For classes with operations + "js:es6-module"]] module Test { @@ -184,6 +185,29 @@ class L sequence<Value> ValueSeq; dictionary<string, Value> ValueMap; +struct StructKey +{ + int i; + string s; +} + +dictionary<StructKey, L> LMap; + +class M +{ + LMap v; +} + +// Forward declarations +class F1; +interface F2; + +class F3 +{ + F1 f1; + F2* f2; +} + interface Initial { void shutdown(); @@ -227,6 +251,13 @@ interface Initial void throwInnerEx() throws Inner::Ex; void throwInnerSubEx() throws Inner::Sub::Ex; + + M opM(M v1, out M v2); + + F1 opF1(F1 f11, out F1 f12); + F2* opF2(F2* f21, out F2* f22); + F3 opF3(F3 f31, out F3 f32); + bool hasF3(); } class Empty |