Exemplo n.º 1
0
        public void TestParseResultListConstValues()
        {
            MIResults r = new MIResults(null);
            string miString = @"name=""value"""; // name="value"
            Results results = r.ParseResultList(miString);

            Assert.Equal(1, results.Content.Length);
            Assert.Equal("name", results.Content[0].Name);
            Assert.True(results.Content[0].Value is ConstValue);
            Assert.Equal("value", (results.Content[0].Value as ConstValue).Content);
            Assert.Equal("value", results.FindString("name"));

            miString = @"name1=""value1"",name2=""value2"""; // name1="value1",name2="value2"
            results = r.ParseResultList(miString);

            Assert.Equal(2, results.Content.Length);
            Assert.Equal("name1", results.Content[0].Name);
            Assert.Equal("name2", results.Content[1].Name);
            Assert.True(results.Content[0].Value is ConstValue);
            Assert.True(results.Content[1].Value is ConstValue);
            Assert.Equal("value1", (results.Content[0].Value as ConstValue).Content);
            Assert.Equal("value2", (results.Content[1].Value as ConstValue).Content);
            Assert.Equal("value1", results.FindString("name1"));
            Assert.Equal("value2", results.FindString("name2"));
        }
Exemplo n.º 2
0
        public void TestParseResultListConstValues()
        {
            MIResults r        = new MIResults(null);
            string    miString = @"name=""value"""; // name="value"
            Results   results  = r.ParseResultList(miString);

            Assert.Equal(1, results.Content.Length);
            Assert.Equal("name", results.Content[0].Name);
            Assert.True(results.Content[0].Value is ConstValue);
            Assert.Equal("value", (results.Content[0].Value as ConstValue).Content);
            Assert.Equal("value", results.FindString("name"));

            miString = @"name1=""value1"",name2=""value2"""; // name1="value1",name2="value2"
            results  = r.ParseResultList(miString);

            Assert.Equal(2, results.Content.Length);
            Assert.Equal("name1", results.Content[0].Name);
            Assert.Equal("name2", results.Content[1].Name);
            Assert.True(results.Content[0].Value is ConstValue);
            Assert.True(results.Content[1].Value is ConstValue);
            Assert.Equal("value1", (results.Content[0].Value as ConstValue).Content);
            Assert.Equal("value2", (results.Content[1].Value as ConstValue).Content);
            Assert.Equal("value1", results.FindString("name1"));
            Assert.Equal("value2", results.FindString("name2"));
        }
Exemplo n.º 3
0
        public void TestParseCStringNull()
        {
            string miString = null; //input = <null>

            Assert.Throws <ArgumentNullException>(delegate
            {
                MIResults.ParseCString(miString);
            });
        }
Exemplo n.º 4
0
        public void TestParseCStringNull()
        {
            string miString = null; //input = <null>

            Assert.Throws<ArgumentNullException>(delegate
            {
                MIResults r = new MIResults(null);
                r.ParseCString(miString);
            });
        }
Exemplo n.º 5
0
        public void TestParseCStringEmpty()
        {
            string miString = ""; // input = <empty>
            string result   = MIResults.ParseCString(miString);

            Assert.Equal(String.Empty, result);

            miString = "\"\""; // input = ""
            result   = MIResults.ParseCString(miString);

            Assert.Equal(String.Empty, result);
        }
Exemplo n.º 6
0
        public void TestParseCStringEmpty()
        {
            MIResults r        = new MIResults(null);
            string    miString = ""; // input = <empty>
            string    result   = r.ParseCString(miString);

            Assert.Equal(String.Empty, result);

            miString = "\"\""; // input = ""
            result   = r.ParseCString(miString);

            Assert.Equal(String.Empty, result);
        }
Exemplo n.º 7
0
        public void TestParseCStringEmpty()
        {
            MIResults r = new MIResults(null);
            string miString = ""; // input = <empty>
            string result = r.ParseCString(miString);

            Assert.Equal(String.Empty, result);

            miString = "\"\""; // input = ""
            result = r.ParseCString(miString);

            Assert.Equal(String.Empty, result);
        }
Exemplo n.º 8
0
        public void TestParseCString()
        {
            string miString = "\"hello\""; //input = "hello"
            string result   = MIResults.ParseCString(miString);

            Assert.Equal("hello", result);

            miString = "\"\\tHello\\n\""; //input = "\tHello\n"
            result   = MIResults.ParseCString(miString);
            Assert.Equal("\tHello\n", result);

            miString = "\"    \""; //input = <four spaces>
            result   = MIResults.ParseCString(miString);
            Assert.Equal("    ", result);

            miString = "    \"Hello\"     "; //input = <leading spaces>"Hello"<trailing spaces>
            result   = MIResults.ParseCString(miString);
            Assert.Equal("Hello", result);

            miString = "\"\"\"\"\"\""; //input = """"""
            result   = MIResults.ParseCString(miString);
            Assert.Equal("\"\"", result);
        }
Exemplo n.º 9
0
        public void TestParseCString()
        {
            MIResults r = new MIResults(null);
            string miString = "\"hello\""; //input = "hello"
            string result = r.ParseCString(miString);
            Assert.Equal("hello", result);

            miString = "\"\\tHello\\n\""; //input = "\tHello\n"
            result = r.ParseCString(miString);
            Assert.Equal("\tHello\n", result);

            miString = "\"    \""; //input = <four spaces>
            result = r.ParseCString(miString);
            Assert.Equal("    ", result);

            miString = "    \"Hello\"     "; //input = <leading spaces>"Hello"<trailing spaces>
            result = r.ParseCString(miString);
            Assert.Equal("Hello", result);

            miString = "\"\"\"\"\"\""; //input = """"""
            result = r.ParseCString(miString);
            Assert.Equal("\"\"", result);
        }
Exemplo n.º 10
0
 public Results IsModuleLoad(string cmd)
 {
     Results results = null;
     if (cmd.StartsWith("library-loaded,", StringComparison.Ordinal))
     {
         MIResults res = new MIResults(_debugger.Logger);
         results = res.ParseResultList(cmd.Substring(15));
     }
     return results;
 }
Exemplo n.º 11
0
 public Debugger(LaunchOptions launchOptions, Logger logger)
 {
     _launchOptions = launchOptions;
     _debuggeePids = new Dictionary<string, int>();
     Logger = logger;
     _miResults = new MIResults(logger);
 }