Пример #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);
            }
        }
Пример #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());
            }
        }
Пример #3
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);
            }
        }
Пример #4
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());
            }
        }