summaryrefslogtreecommitdiff
path: root/graphics/asymptote/tests/imp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/asymptote/tests/imp
Initial commit
Diffstat (limited to 'graphics/asymptote/tests/imp')
-rw-r--r--graphics/asymptote/tests/imp/unravel.asy95
1 files changed, 95 insertions, 0 deletions
diff --git a/graphics/asymptote/tests/imp/unravel.asy b/graphics/asymptote/tests/imp/unravel.asy
new file mode 100644
index 0000000000..0f61326fd6
--- /dev/null
+++ b/graphics/asymptote/tests/imp/unravel.asy
@@ -0,0 +1,95 @@
+import TestLib;
+StartTest("unravel");
+{
+ struct A {
+ int x=1, y=2, z=3;
+ int y() { return 7; }
+ }
+
+ A a=new A;
+ unravel a;
+ assert(x==1);
+ assert(y==2);
+ assert(z==3);
+ assert(y()==7);
+}
+{
+ struct A {
+ private int x=1;
+ int y=2, z=3;
+ int y() { return 7; }
+ }
+
+ int x=5;
+ A a=new A;
+ unravel a;
+ assert(x==5);
+ assert(y==2);
+ assert(z==3);
+}
+{
+ struct A {
+ public int x=1;
+ int y=2, z=3;
+ int y() { return 7; }
+ }
+
+ int z=5;
+ A a=new A;
+ from a unravel x,y;
+ assert(x==1);
+ assert(y==2);
+ assert(z==5);
+ assert(y()==7);
+}
+{
+ struct A {
+ public int x=1;
+ int y=2, z=3;
+ int y() { return 7; }
+ }
+
+ int y=4;
+ int z=5;
+ A a=new A;
+ from a unravel x,y as blah;
+ assert(x==1);
+ assert(y==4);
+ assert(blah==2);
+ assert(z==5);
+ assert(blah()==7);
+}
+{
+ struct A {
+ struct B {
+ static int x=4;
+ }
+ }
+ A a=new A;
+ int x=3;
+ from a.B unravel x;
+ assert(x==4);
+}
+{
+ struct A {
+ struct B {
+ static int x=4;
+ }
+ }
+ A a=new A;
+ A.B b=new a.B;
+ int x=3;
+ from b unravel x;
+ assert(x==4);
+}
+{
+ struct A {
+ static struct B {
+ static int x=4;
+ }
+ }
+ int x=3;
+ from A.B unravel x;
+ assert(x==4);
+}
+EndTest();