public void WrapMultipleNewlines() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.Append("abcde"); lineWrapper.WrappingSpace(2); lineWrapper.Append("fghi\nklmnopq\nrs"); lineWrapper.WrappingSpace(2); lineWrapper.Append("tuvwxyz1"); lineWrapper.Close(); Assert.AreEqual("abcde fghi\nklmnopq\nrs\n tuvwxyz1", @out.ToString()); }
public void MultipleWrite() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.Append("ab"); lineWrapper.WrappingSpace(1); lineWrapper.Append("cd"); lineWrapper.WrappingSpace(1); lineWrapper.Append("ef"); lineWrapper.WrappingSpace(1); lineWrapper.Append("gh"); lineWrapper.WrappingSpace(1); lineWrapper.Append("ij"); lineWrapper.WrappingSpace(1); lineWrapper.Append("kl"); lineWrapper.WrappingSpace(1); lineWrapper.Append("mn"); lineWrapper.WrappingSpace(1); lineWrapper.Append("op"); lineWrapper.WrappingSpace(1); lineWrapper.Append("qr"); lineWrapper.Close(); Assert.AreEqual("ab cd ef\n gh ij kl\n mn op qr", @out.ToString()); }
public void OverlyLongLinesWithLeadingSpace() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.WrappingSpace(2); lineWrapper.Append("abcdefghijkl"); lineWrapper.Close(); Assert.AreEqual("\n abcdefghijkl", @out.ToString()); }
public void NoWrap() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.Append("abcde"); lineWrapper.WrappingSpace(2); lineWrapper.Append("fghi"); lineWrapper.Close(); Assert.AreEqual("abcde fghi", @out.ToString()); }
public void WrapEmbeddedNewlines() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.Append("abcde"); lineWrapper.WrappingSpace(2); lineWrapper.Append("fghij\nklmn"); lineWrapper.Append("opqrstuvwxy"); lineWrapper.Close(); Assert.AreEqual("abcde\n fghij\nklmnopqrstuvwxy", @out.ToString()); }
public void Fencepost() { var @out = new AppendableStringBuilder(); var lineWrapper = new LineWrapper(@out, " ", 10); lineWrapper.Append("abcde"); lineWrapper.Append("fghij"); lineWrapper.WrappingSpace(2); lineWrapper.Append("k"); lineWrapper.Append("lmnop"); lineWrapper.Close(); Assert.AreEqual("abcdefghij\n klmnop", @out.ToString()); }