Exemple #1
0
        public void TestSplitWithLineBreak()
        {
            CollectionAssert.AreEqual(
                new [] { "foo", "bar", "baz" },
                StyledTextUtil.SplitWithBlockBreak("foo\r\nbar\r\nbaz")
                );

            CollectionAssert.AreEqual(
                new [] { "foo", "bar", "baz" },
                StyledTextUtil.SplitWithBlockBreak("foo\r\nbar\r\nbaz\r\n")
                );

            CollectionAssert.AreEqual(
                new [] { "foo" },
                StyledTextUtil.SplitWithBlockBreak("foo")
                );

            /// \r改行
            CollectionAssert.AreEqual(
                new [] { "foo", "bar", "baz" },
                StyledTextUtil.SplitWithBlockBreak("foo\rbar\rbaz")
                );

            /// \n改行
            CollectionAssert.AreEqual(
                new [] { "foo", "bar", "baz" },
                StyledTextUtil.SplitWithBlockBreak("foo\nbar\nbaz")
                );

            /// 空
            CollectionAssert.AreEqual(
                new string[0],
                StyledTextUtil.SplitWithBlockBreak("")
                );

            CollectionAssert.AreEqual(
                new string[0],
                StyledTextUtil.SplitWithBlockBreak(null)
                );
        }
Exemple #2
0
 public void TestNormalizeLineBreak()
 {
     Assert.AreEqual("foo\rbar", StyledTextUtil.NormalizeLineBreak("foo\r\nbar", "\r"));
     Assert.AreEqual("foo\nbar", StyledTextUtil.NormalizeLineBreak("foo\rbar", "\n"));
     Assert.AreEqual("foo\rbar", StyledTextUtil.NormalizeLineBreak("foo\nbar", "\r"));
 }