Exemple #1
0
        public void VerifySyntaxWithMultipleSyntaxErrors()
        {
            var projects = new Mock <ILinkScriptsToProjects>();

            using (var writer = new ScriptOutputPipe())
            {
                writer.OnScriptOutput += (s, e) => { };

                var engine = Python.CreateEngine();
                var runner = new RemoteScriptRunner(projects.Object, writer, engine);

                var script = "prin 10" + Environment.NewLine + "prin 20";
                var errors = runner.VerifySyntax(script);
                Assert.AreEqual(2, errors.Count());

                var error = errors.First();
                Assert.AreEqual(1, error.Line);
                Assert.AreEqual(6, error.Column);
                Assert.AreEqual(SyntaxVerificationSeverity.Error, error.Severity);

                error = errors.Last();
                Assert.AreEqual(2, error.Line);
                Assert.AreEqual(6, error.Column);
                Assert.AreEqual(SyntaxVerificationSeverity.Error, error.Severity);
            }
        }
Exemple #2
0
        public void VerifySyntaxWithoutSyntaxErrors()
        {
            var projects = new Mock <ILinkScriptsToProjects>();

            using (var writer = new ScriptOutputPipe())
            {
                writer.OnScriptOutput += (s, e) => { };

                var engine = Python.CreateEngine();
                var runner = new RemoteScriptRunner(projects.Object, writer, engine);

                var script = "print \"Hello\"";
                var errors = runner.VerifySyntax(script);
                Assert.AreEqual(0, errors.Count());
            }
        }
        public void VerifySyntaxWithMultipleSyntaxErrors()
        {
            var projects = new Mock<ILinkScriptsToProjects>();
            using (var writer = new ScriptOutputPipe())
            {
                writer.OnScriptOutput += (s, e) => { };

                var engine = Python.CreateEngine();
                var runner = new RemoteScriptRunner(projects.Object, writer, engine);

                var script = "prin 10" + Environment.NewLine + "prin 20";
                var errors = runner.VerifySyntax(script);
                Assert.AreEqual(2, errors.Count());

                var error = errors.First();
                Assert.AreEqual(1, error.Line);
                Assert.AreEqual(6, error.Column);
                Assert.AreEqual(SyntaxVerificationSeverity.Error, error.Severity);

                error = errors.Last();
                Assert.AreEqual(2, error.Line);
                Assert.AreEqual(6, error.Column);
                Assert.AreEqual(SyntaxVerificationSeverity.Error, error.Severity);
            }
        }
        public void VerifySyntaxWithoutSyntaxErrors()
        {
            var projects = new Mock<ILinkScriptsToProjects>();
            using (var writer = new ScriptOutputPipe())
            {
                writer.OnScriptOutput += (s, e) => { };

                var engine = Python.CreateEngine();
                var runner = new RemoteScriptRunner(projects.Object, writer, engine);

                var script = "print \"Hello\"";
                var errors = runner.VerifySyntax(script);
                Assert.AreEqual(0, errors.Count());
            }
        }