コード例 #1
0
        public async Task GetChildrenReturnsMoreElementWhenMoreThanRangeSizeRequestedAsync()
        {
            remoteValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("child5", "value5"));

            int _countPerRange = 2;
            var childAdapter   = new RemoteValueChildAdapter.Factory().CreateForTesting(
                remoteValue, RemoteValueFormat.Default, varInfoBuilder, noFormatSpecifier,
                _countPerRange);

            IList <IVariableInformation> children = await childAdapter.GetChildrenAsync(0, 5);

            Assert.That(children.Count, Is.EqualTo(3));
            Assert.That(children[2].DisplayName, Is.EqualTo("[More]"));

            IVariableInformation more = children[2];

            CollectionAssert.AreEqual(new[] { "child3", "child4", "[More]" },
                                      await GetAllChildNamesAsync(more.GetChildAdapter()));

            IVariableInformation nextMore =
                (await more.GetChildAdapter().GetChildrenAsync(2, 1))[0];

            CollectionAssert.AreEqual(new[] { "child5" },
                                      await GetAllChildNamesAsync(nextMore.GetChildAdapter()));
        }
コード例 #2
0
        public void FormatValue()
        {
            const string    value       = "test \t \n";
            RemoteValueFake remoteValue = RemoteValueFakeUtil.CreateSimpleString("tmp", value);

            Assert.That(format.FormatValue(remoteValue, ValueFormat.Default), Is.EqualTo(value));
        }
コード例 #3
0
        public void StringViewUnescapesStringsAndRemovesBraces()
        {
            string unescapedString = "somes\\tring\"view";
            var    remoteValue     = RemoteValueFakeUtil.CreateSimpleString(
                "x", CStringEscapeHelper.Escape(unescapedString));

            var varInfo = CreateVarInfo(remoteValue, "x");

            Assert.That(varInfo.StringView, Is.EqualTo(unescapedString));
        }
コード例 #4
0
        public void FormatStringView()
        {
            // Value has to be quoted, so that FormatStringView recognizes it as string.
            const string    value          = "\"test \\t \\n\"";
            const string    unescapedValue = "test \t \n";
            RemoteValueFake remoteValue    = RemoteValueFakeUtil.CreateSimpleString("tmp", value);

            Assert.That(format.FormatStringView(remoteValue, ValueFormat.Default),
                        Is.EqualTo(unescapedValue));
        }
コード例 #5
0
        public async Task Build_ClassValueAsync()
        {
            RemoteValueFake classValue = RemoteValueFakeUtil.CreateClass("C", "c", "");

            classValue.AddChild(RemoteValueFakeUtil.CreateSimpleInt("f", 42));
            classValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("g", "\"s\""));

            IVariableInformation varInfo = CreateVarInfo(classValue, "3");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo("{f=42 g=\"s\"}"));
        }
コード例 #6
0
        public void SetUp()
        {
            remoteValue = RemoteValueFakeUtil.CreateClass("int[]", "array", "");
            remoteValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("child1", "value1"));
            remoteValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("child2", "value2"));
            remoteValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("child3", "value3"));
            remoteValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("child4", "value4"));

            var childAdapterFactory = new RemoteValueChildAdapter.Factory();
            var varInfoFactory      = new LLDBVariableInformationFactory(childAdapterFactory);

            varInfoBuilder = new VarInfoBuilder(varInfoFactory);
            varInfoFactory.SetVarInfoBuilder(varInfoBuilder);
        }
コード例 #7
0
        public async Task Build_PointerClassValueAsync()
        {
            string          address = $"0x{_pointerAddress:x16}";
            RemoteValueFake pointer =
                RemoteValueFakeUtil.CreatePointer("C*", "pc", _pointerAddress.ToString());

            pointer.AddChild(RemoteValueFakeUtil.CreateSimpleInt("f", 42));
            pointer.AddChild(RemoteValueFakeUtil.CreateSimpleString("g", "\"s\""));

            IVariableInformation varInfo = CreateVarInfo(pointer, "");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo($"0x{_pointerAddress:x16} {{f=42 g=\"s\"}}"));
        }