コード例 #1
0
ファイル: ObjectOperationsTest.cs プロジェクト: zuvys/dlr
        [Ignore] // BUG 476154
        public void TestFromFuture_UsingOperations()
        {
            ScriptRuntime sr          = CreateRuntime();
            ScriptScope   futureScope = _testEng.CreateScope();

            futureScope.SetVariable("division", true);
            sr.Globals.SetVariable("__future__", futureScope);

            ScriptSource source = _testEng.CreateScriptSourceFromString(_codeSnippets[CodeType.ImportFutureDiv],
                                                                        SourceCodeKind.Statements);
            ScriptScope localScope = _testEng.CreateScope();

            source.Execute(localScope);

            ObjectOperations operation = _testEng.CreateOperations(localScope);

            // now do div operations and check result
            object divResult = operation.Divide(1, 2);

            // if this is future style then the result should be 0.5
            Assert.AreEqual(0.5, (double)divResult);
        }