diff options
Diffstat (limited to 'graphics/asymptote/tests/template/multiImport.asy')
-rw-r--r-- | graphics/asymptote/tests/template/multiImport.asy | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/graphics/asymptote/tests/template/multiImport.asy b/graphics/asymptote/tests/template/multiImport.asy new file mode 100644 index 0000000000..94d5c30feb --- /dev/null +++ b/graphics/asymptote/tests/template/multiImport.asy @@ -0,0 +1,25 @@ +import TestLib; + +StartTest('multiple_imports'); +struct A {int x=1;} +access "template/imports/C"(T=A) as p; +assert(p.global == 17); +p.global = 42; +access "template/imports/C"(T=A) as q; +assert(q.global == 42); +EndTest(); + +StartTest('import_in_function'); +struct B {int x=1;} +void f(int expected, int newValue) { + // Importing inside a function is not recommended practice, but it should + // work. + access "template/imports/C"(T=B) as p; + assert(p.global == expected); + p.global = newValue; +} +f(17, 23); +f(23, 27); +access "template/imports/C"(T=B) as p; +assert(p.global == 27); +EndTest(); |