All files / test/Slice/escape Client.js

93.1% Statements 54/58
60% Branches 3/5
100% Functions 2/2
93.1% Lines 54/58

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 591x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
// Copyright (c) ZeroC, Inc.
import { Ice } from "@zeroc/ice";
import { TestHelper, test } from "../../Common/TestHelper.js";
import { escapedAwait } from "./Key.js";
export class Client extends TestHelper {
    async allTests() {
        const communicator = this.communicator();
        const out = this.getWriter();
        out.write("testing enums... ");
        test(escapedAwait._var.base.value === 0);
        out.writeLine("ok");
        out.write("testing structs... ");
        const s = new escapedAwait._break(10);
        test(s._while == 10);
        out.writeLine("ok");
        out.write("testing proxies... ");
        const casePrx = new escapedAwait._casePrx(communicator, `hello: ${this.getTestEndpoint()}`);
        try {
            await casePrx._catch(10);
            test(false);
        }
        catch (ex) {
            test(ex instanceof Ice.LocalException);
        }
        const typeofPrx = new escapedAwait._typeofPrx(communicator, `hello: ${this.getTestEndpoint()}`).ice_invocationTimeout(100);
        try {
            await typeofPrx._default();
            test(false);
        }
        catch (ex) {
            test(ex instanceof Ice.LocalException);
        }
        out.writeLine("ok");
        out.write("testing classes... ");
        const d = new escapedAwait._delete(null, 10);
        test(d._else === null);
        test(d._export === 10);
        const p = new escapedAwait._package(new escapedAwait._break(100), escapedAwait._var.base, new escapedAwait.explicitPrx(communicator, "hello"), new Map(), "");
        test(p._for._while === 100);
        test(p.goto === escapedAwait._var.base);
        test(p.internal instanceof Map);
        test(p._debugger === "");
        test(p._null instanceof escapedAwait.explicitPrx);
        out.writeLine("ok");
    }
    async run(args) {
        let communicator = null;
        try {
            [communicator] = this.initialize(args);
            await this.allTests();
        }
        finally {
            if (communicator) {
                await communicator.destroy();
            }
        }
    }
}