summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/tests/types/shadow.asy
blob: 09d73abc0206d2d25b3d26049d2b2659c56ad1f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import TestLib;
StartTest("shadow");
int x = 1;
int getX() { return x; }
void setX(int value) { x=value; }

// Shadow x with another int, but x should still be in memory.
int x = 2;
assert(x==2);
assert(getX()==1);
x = 4;
assert(x==4);
assert(getX()==1);
setX(7);
assert(x==4);
assert(getX()==7);
EndTest();