예제 #1
0
        public void Can_Create_Engine()
        {
            var compiler = new TypeScriptWriter();
            var engine   = compiler.GetEngine();

            Assert.NotNull(engine);
        }
예제 #2
0
        public void Can_Get_Exception_Result()
        {
            var compiler = new TypeScriptWriter();
            var engine   = compiler.GetEngine();

            var test = @"functio greeter(person: stringz) {
                                        return ""Hello, "" +=-+ person;
                                    
                                    var user = ""Jane User"";
                                    document.body.innerHTML = greeter(user);";


            Assert.Throws <TypeScriptCompilationException>(() => compiler.CompileTypeScript(engine, test));
        }
예제 #3
0
        public void Can_Get_Successfull_Result()
        {
            var compiler = new TypeScriptWriter();
            var engine   = compiler.GetEngine();

            var test = @"function greeter(person: string) {
                            return ""Hello, "" + person;
                        }
                        var user = ""Jane User"";
                        document.body.innerHTML = greeter(user);";

            var result = compiler.CompileTypeScript(engine, test);

            Assert.IsFalse(TypeScriptCompilationErrorParser.HasErrors(result));
        }