Ejemplo n.º 1
0
    public IEnumerator ErrorResponseTest()
    {
        // Tell the server its id (so he doesn't try to pass the message on)
        ConfigController.ApplicationSettings.id = new SourceReference(1, 1, 1, 0);
        ServerCore.Init();
        string returnValue = null;

        ClientSocket.Instance.OnError +=
            (CoflnetException coflnetException) => {
            returnValue = coflnetException.Slug;
        };

        ClientSocket.Instance.Reconnect();
        yield return(new UnityEngine.WaitForSeconds(1));

        var newId = new SourceReference(1, 1, 1, ThreadSaveIdGenerator.NextId);

        // the error is whitelisted
        // beause the console is also the server console this would cause the test to faild otherwise
        LogAssert.Expect(UnityEngine.LogType.Error,
                         new Regex($".*{Regex.Escape(newId.ToString())}.*wasn't found on this server.*"));

        ClientSocket.Instance.SendCommand(new CommandData(newId), false);

        yield return(new UnityEngine.WaitForSeconds(1));

        // test the expected error slug
        Assert.AreEqual(returnValue, "object_not_found");

        ServerCore.Stop();
        //retrivedRes.GetCommandController().ExecuteCommand(new CommandData(id, null, "coreTest"));
    }
        public void ToString_IncludesFilenameAndLineNumber()
        {
            var reference = new SourceReference
            {
                File       = "The file",
                LineNumber = 44
            };

            Assert.That(reference.ToString(), Is.EqualTo("The file:44"));
        }
        public void ToString_IncludesMethodName()
        {
            var reference = new SourceReference
            {
                File       = "The file",
                LineNumber = 44,
                Column     = 1,
                MethodName = "dummy"
            };

            Assert.That(reference.ToString(), Is.EqualTo("The file:44:1#dummy"));
        }
Ejemplo n.º 4
0
        private void print_message(SourceReference source, string type, string type_color_start, string type_color_end, string message, bool do_report_source)
        {
            if (source != null)
            {
                stderr.printf("%s%s:%s ", locus_color_start, source.ToString(), locus_color_end);
            }

            stderr.printf("%s%s:%s ", type_color_start, type, type_color_end);

            // highlight '', `', ``
            print_highlighted_message(message);
            stderr.putc('\n');

            if (do_report_source && source != null)
            {
                report_source(source);
            }

            if (Debugger.IsAttached)
            {
                Debug.WriteLine($"[{type_color_start}] {message}");
            }
        }
Ejemplo n.º 5
0
 public override string ToString() => SourceReference.ToString();