コード例 #1
0
        public void TestSkipWhitespaces()
        {
            var text = new StringLineGroup("             ABC").ToCharIterator();

            Assert.True(text.TrimStart());
            Assert.AreEqual('A', text.CurrentChar);
        }
コード例 #2
0
        public void TestStringLineGroupWithTrim()
        {
            var line1 = new StringSlice("  ABC  ");
            line1.NextChar();
            line1.NextChar();

            var line2 = new StringSlice("  DEF ");

            var text = new StringLineGroup(4) { line1, line2}.ToCharIterator();
            text.TrimStart();

            var result = ToString(text);
            TextAssert.AreEqual("ABC  \n  DEF ", result);
        }
コード例 #3
0
        public void TestSkipWhitespaces()
        {
            var text = new StringLineGroup("             ABC").ToCharIterator();
            Assert.False(text.TrimStart());
            Assert.AreEqual('A', text.CurrentChar);

            text = new StringLineGroup("        ").ToCharIterator();
            Assert.True(text.TrimStart());
            Assert.AreEqual('\0', text.CurrentChar);

            var slice = new StringSlice("             ABC");
            Assert.False(slice.TrimStart());

            slice = new StringSlice("        ");
            Assert.True(slice.TrimStart());
        }