Esempio n. 1
0
        public void TestGetLineListSingleLineWithWhitespaceBeforeNewLine()
        {
            List <string>        lines = LineUtil.GetLineList("hello    \r\n");
            IEnumerator <string> iter  = lines.GetEnumerator();

            iter.MoveNext();
            string line = (string)iter.Current;

            Assert.AreEqual("hello    ", line);
        }
Esempio n. 2
0
        /// <summary>
        /// Parse all tags from the ctags output.
        /// </summary>
        public List <Tag> ParseCtagsOutput(string inCtagsOutput)
        {
            List <Tag>    tags  = new List <Tag>();
            List <string> lines = LineUtil.GetLineList(inCtagsOutput);

            foreach (string line in lines)
            {
                Tag tag = GetTag(line);
                if (tag.GetTagType() != Tag.EType.EUnknown)
                {
                    tags.Add(tag);
                }
            }
            return(tags);
        }
Esempio n. 3
0
        public void TestGetLineList()
        {
            List <string>        lines      = null;
            IEnumerator <string> enumerator = null;

            lines = LineUtil.GetLineList("");
            Assert.AreEqual(0, lines.Count);

            lines = LineUtil.GetLineList("hello\r\nworld\r\n");
            Assert.AreEqual(3, lines.Count);
            enumerator = lines.GetEnumerator();
            enumerator.MoveNext();
            Assert.AreEqual("hello", (string)enumerator.Current);
            enumerator.MoveNext();
            Assert.AreEqual("world", (string)enumerator.Current);
            enumerator.MoveNext();
            Assert.AreEqual("", (string)enumerator.Current);
        }
Esempio n. 4
0
        /// <summary>
        /// Remove #include statements from C++ source.
        /// </summary>
        /// <param name="ioContents"></param>
        public void RemoveIncludes(ref string ioContents)
        {
            List <string> lines       = LineUtil.GetLineList(ioContents);
            StringBuilder output      = new StringBuilder();
            bool          add_newline = false;

            foreach (string line in lines)
            {
                if (add_newline)
                {
                    output.Append("\r\n");
                }
                add_newline = true;

                string trimmed_line = line.Trim();
                if (!IncludeFinder.IsInclude(line))
                {
                    output.Append(line);
                }
            }
            ioContents = output.ToString();
        }
Esempio n. 5
0
        public void TestGetLineListSingleLineWithNewLine()
        {
            List <string> lines = LineUtil.GetLineList("hello\r\n");

            Assert.AreEqual(2, lines.Count);
        }
Esempio n. 6
0
        public void TestGetLineListSingleLine()
        {
            List <string> lines = LineUtil.GetLineList("hello");

            Assert.AreEqual(1, lines.Count);
        }
Esempio n. 7
0
        public void TestGetLineListEmptyString()
        {
            List <string> lines = LineUtil.GetLineList("");

            Assert.AreEqual(0, lines.Count);
        }