summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tests/types/init.asy
blob: 5557bd0676cc24364a13ef7e97ee1f061ba5ea00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import TestLib;
StartTest("init");
int operator init() { return 7; }
int x;
assert(x==7);

struct A {
  int x=3;
}
A a;
assert(a!=null);
assert(a.x==3);

A operator init() { return null; }
A aa;
assert(aa==null);
EndTest();