public void LoadModulesFromLib() { var context = new BindingEnvironment(); Assert.IsNotNull(ModuleUtilities.LoadModule("module1", context)); Assert.IsNotNull(ModuleUtilities.LoadModule("module2", context)); }
public void Execute(IContext context) { Module module = ModuleUtilities.LoadModule(this.modname, context); IValues values = context; int nname = 0; foreach (var name in this.names) { string normname = name.Trim(); if (nname == this.names.Length - 1) { values.SetValue(normname, module); } else if (!values.HasValue(normname)) { var mod = new Module(context.GlobalContext); values.SetValue(normname, mod); values = mod; } else { values = (IValues)values.GetValue(normname); } nname++; } }
public void LoadCachedModule() { var context = new BindingEnvironment(); var module = ModuleUtilities.LoadModule("setvar", context); var module2 = ModuleUtilities.LoadModule("setvar", context); Assert.IsNotNull(module); Assert.AreEqual(module, module2); }
public void LoadSimpleModule() { var context = new BindingEnvironment(); var module = ModuleUtilities.LoadModule("setvar", context); Assert.IsNotNull(module); Assert.AreEqual(context, module.GlobalContext); Assert.IsNotNull(module.GetValue("a")); Assert.AreEqual("setvar module", module.GetValue("__doc__")); }
public void Execute(IContext context) { Module module = ModuleUtilities.LoadModule(this.modname, context); if (this.names != null) { foreach (string name in this.names) { context.SetValue(name, module.GetValue(name)); } } else { foreach (string name in module.GetNames()) { context.SetValue(name, module.GetValue(name)); } } }