Exemple #1
0
        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());
        }
Exemple #2
0
        public void OverlyLongLinesWithoutLeadingSpace()
        {
            var @out        = new AppendableStringBuilder();
            var lineWrapper = new LineWrapper(@out, "  ", 10);

            lineWrapper.Append("abcdefghijkl");
            lineWrapper.Close();
            Assert.AreEqual("abcdefghijkl", @out.ToString());
        }
Exemple #3
0
        public void NospaceWrapMax()
        {
            var @out        = new AppendableStringBuilder();
            var lineWrapper = new LineWrapper(@out, "  ", 10);

            lineWrapper.Append("abcde");
            lineWrapper.ZeroWidthSpace(2);
            lineWrapper.Append("fghijk");
            lineWrapper.Close();
            Assert.AreEqual("abcde\n    fghijk", @out.ToString());
        }
Exemple #4
0
        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());
        }
Exemple #5
0
        public void wrapEmbeddedNewlines_ZeroWidth()
        {
            var @out        = new AppendableStringBuilder();
            var lineWrapper = new LineWrapper(@out, "  ", 10);

            lineWrapper.Append("abcde");
            lineWrapper.ZeroWidthSpace(2);
            lineWrapper.Append("fghijk\nlmn");
            lineWrapper.Append("opqrstuvwxy");
            lineWrapper.Close();
            Assert.AreEqual("abcde\n    fghijk\nlmnopqrstuvwxy", @out.ToString());
        }
Exemple #6
0
        public void NoWrapEmbeddedNewlines()
        {
            var @out        = new AppendableStringBuilder();
            var lineWrapper = new LineWrapper(@out, "  ", 10);

            lineWrapper.Append("abcde");
            lineWrapper.WrappingSpace(2);
            lineWrapper.Append("fghi\njklmn");
            lineWrapper.Append("opqrstuvwxy");
            lineWrapper.Close();
            Assert.AreEqual("abcde fghi\njklmnopqrstuvwxy", @out.ToString());
        }
Exemple #7
0
        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());
        }
Exemple #8
0
        public void FencepostZeroWidth()
        {
            var @out        = new AppendableStringBuilder();
            var lineWrapper = new LineWrapper(@out, "  ", 10);

            lineWrapper.Append("abcde");
            lineWrapper.Append("fghij");
            lineWrapper.ZeroWidthSpace(2);
            lineWrapper.Append("k");
            lineWrapper.Append("lmnop");
            lineWrapper.Close();
            Assert.AreEqual("abcdefghij\n    klmnop", @out.ToString());
        }