summaryrefslogtreecommitdiff
path: root/Examples/test-suite/javascript/constructor_copy_runme.js
blob: 179b9fb40635548a67c74013be9d270c78f58888 (plain)
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
var constructor_copy = require("constructor_copy");

f1 = new constructor_copy.Foo1(3);
f11 = new constructor_copy.Foo1(f1);

if (f1.x != f11.x) {
  throw "error in ctor copy for Foo1";
}

var good = 0;

f8 = new constructor_copy.Foo8()
try {
  f81 = new constructor_copy.Foo8(f8);
  good = 0;
} catch (err) {
  good = 1;
}

if (good == 0) {
  throw "Error: should not allow calling copy ctor for Foo8";
}


bi = new constructor_copy.Bari(5);
bc = new constructor_copy.Bari(bi);

if (bi.x != bc.x) {
  throw "Error in copy ctor of Bari";
}

bd = new constructor_copy.Bard(5);
try {
  bc = new constructor_copy.Bard(bd);
  good = 0;
} catch (err) {
  good = 1;
}

if (good == 0) {
  throw "Error: should not allow calling copy ctor for Bard";
}