public void ExceptionHandlingStatementRequiresCatchVariable()
        {
            var e = new ExceptionHandlingStatement
            {
                TryBlock = new CompoundStatement(),
                CatchBlock = new CompoundStatement()
            };

            Expect.Throw<InvalidOperationException>(() => e.ToString());
        }
Exemplo n.º 2
0
        public void ExceptionHandlingStatementRequiresCatchVariable()
        {
            var e = new ExceptionHandlingStatement
            {
                TryBlock   = new CompoundStatement(),
                CatchBlock = new CompoundStatement()
            };

            Expect.Throw <InvalidOperationException>(() => e.ToString());
        }
        public void ExceptionHandlingStatementProducesTryCatchFinally()
        {
            var t1 = JS
                .Try(JS.Return())
                .Catch(E, new List<Statement> { Alert.Call(E) })
                .Finally(new List<Statement> { JS.Null() });

            var t2 = new ExceptionHandlingStatement
            {
                TryBlock = new CompoundStatement(JS.Return()),
                CatchVariable = E,
                CatchBlock = new CompoundStatement(Alert.Call(E)),
                FinallyBlock = new CompoundStatement(JS.Null())
            };

            Assert.AreEqual("try{return;}catch(e){alert(e);}finally{null;}", t1.ToString());
            Assert.AreEqual("try{return;}catch(e){alert(e);}finally{null;}", t2.ToString());
        }
Exemplo n.º 4
0
        public void ExceptionHandlingStatementProducesTryCatchFinally()
        {
            var t1 = JS
                     .Try(JS.Return())
                     .Catch(E, new List <Statement> {
                Alert.Call(E)
            })
                     .Finally(new List <Statement> {
                JS.Null()
            });

            var t2 = new ExceptionHandlingStatement
            {
                TryBlock      = new CompoundStatement(JS.Return()),
                CatchVariable = E,
                CatchBlock    = new CompoundStatement(Alert.Call(E)),
                FinallyBlock  = new CompoundStatement(JS.Null())
            };

            Assert.AreEqual("try{return;}catch(e){alert(e);}finally{null;}", t1.ToString());
            Assert.AreEqual("try{return;}catch(e){alert(e);}finally{null;}", t2.ToString());
        }
        public void ExceptionHandlingStatementRequiresTryBlock()
        {
            var e = new ExceptionHandlingStatement();

            Expect.Throw<InvalidOperationException>(() => e.ToString());
        }
Exemplo n.º 6
0
        public void ExceptionHandlingStatementRequiresTryBlock()
        {
            var e = new ExceptionHandlingStatement();

            Expect.Throw <InvalidOperationException>(() => e.ToString());
        }