• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/04_modules/27_precompiled_module_exports

  1 A precompiled module that links another module statically exports its own
  2 symbols, like the module does when it is loaded from source. The exports of
  3 the linked module come first in the export table and are not part of the
  4 namespace.
  5 
  6 -- Testcase --
  7 import { readlink } from 'fs';
  8 
  9 function show(label, mod) {
 10         print(label, ": ", sort(keys(mod)), " ", mod.own(), " ", mod.name, " ", mod.default, "\n");
 11 }
 12 
 13 system([ readlink("/proc/self/exe"), "-cmodule", "-o", "files/precompiled.uc", "files/outer.uc" ]);
 14 
 15 show("source", import("outer"));
 16 show("precompiled", import("precompiled"));
 17 -- End --
 18 
 19 -- File inner.uc --
 20 export function helper() { return "inner helper"; };
 21 export const name = "inner";
 22 export default "inner default";
 23 -- End --
 24 
 25 -- File outer.uc --
 26 import { helper } from "./inner.uc";
 27 
 28 export function own() { return `outer own, ${helper()}`; };
 29 export const name = "outer";
 30 export default "outer default";
 31 -- End --
 32 
 33 -- Args --
 34 -R -L files/
 35 -- End --
 36 
 37 -- Expect stdout --
 38 source: [ "default", "name", "own" ] outer own, inner helper outer outer default
 39 precompiled: [ "default", "name", "own" ] outer own, inner helper outer outer default
 40 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt