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); }
/// <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); }
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); }
/// <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(); }
public void TestGetLineListSingleLineWithNewLine() { List <string> lines = LineUtil.GetLineList("hello\r\n"); Assert.AreEqual(2, lines.Count); }
public void TestGetLineListSingleLine() { List <string> lines = LineUtil.GetLineList("hello"); Assert.AreEqual(1, lines.Count); }
public void TestGetLineListEmptyString() { List <string> lines = LineUtil.GetLineList(""); Assert.AreEqual(0, lines.Count); }