public void SetUp() { _state = new MondState(); MondClassBinder.Bind <ClassTests.Person>(_state); var functions = new List <string> { "ArgumentTypes", "ReturnDouble", "ReturnFloat", "ReturnInt", "ReturnUInt", "ReturnShort", "ReturnUShort", "ReturnSByte", "ReturnByte", "ReturnString", "ReturnBool", "ReturnVoid", "ReturnNullString", "ReturnClass", "Add", "Concat", "Greet" }; foreach (var func in functions) { _state[func] = MondFunctionBinder.Bind(typeof(FunctionTests).GetTypeInfo().GetMethod(func)); } }
public IEnumerable <KeyValuePair <string, MondValue> > GetDefinitions(MondState state) { var module = MondModuleBinder.Bind(typeof(DateTimeModule), state); MondClassBinder.Bind <DateTimeClass>(state); yield return(new KeyValuePair <string, MondValue>("DateTime", module)); }
public void Constructor() { Assert.True(_state.Run("return global.brian.test;") == 123); Assert.True(MondClassBinder.Bind <NoConstructor>(_state) == null); Assert.DoesNotThrow(() => MondClassBinder.Bind <MultipleConstructors>(_state)); }
public void SetUp() { _state = new MondState(); _state["Person"] = MondClassBinder.Bind <Person>(_state); _state.Run(@" global.brian = global.Person('Brian'); "); }
public MondValue ToMond(MondState state) { MondClassBinder.Bind <NamespaceReference>(state, out var prototype); var obj = new MondValue(state) { UserData = this, Prototype = prototype }; obj.Lock(); return(obj); }
public static MondValue Create(MondState state) { MondClassBinder.Bind <AsyncClass>(state, out var prototype); var instance = new AsyncClass(); var obj = MondValue.Object(); obj.UserData = instance; obj.Prototype = prototype; obj.Lock(); return(obj); }
public static MondValue Create(MondState state, RequireLibrary require) { MondClassBinder.Bind <RequireClass>(state, out var prototype); var instance = new RequireClass(); instance._require = require; var obj = new MondValue(MondValueType.Object); obj.UserData = instance; obj.Prototype = prototype; obj.Lock(); return(obj); }
public static MondValue Create(MondState state, ConsoleInputLibrary consoleInput) { MondValue prototype; MondClassBinder.Bind <ConsoleInputClass>(state, out prototype); var instance = new ConsoleInputClass(); instance._consoleInput = consoleInput; var obj = new MondValue(MondValueType.Object); obj.UserData = instance; obj.Prototype = prototype; obj.Lock(); return(obj); }
public IEnumerable <KeyValuePair <string, MondValue> > GetDefinitions(MondState state) { var regexClass = MondClassBinder.Bind <RegexClass>(state); yield return(new KeyValuePair <string, MondValue>("Regex", regexClass)); }
public void Duplicates() { Assert.DoesNotThrow(() => MondClassBinder.Bind <TestDuplicate>(_state)); }