Пример #1
0
        public void TestTrigraphStreamNewlines7()
        {
            // test broken line endings (linux file opened on old mac.)
            String code = "s\r\n\na";
            char   ch;

            MemoryStream   ms = new MemoryStream(Encoding.ASCII.GetBytes(code));
            TrigraphStream ts = new TrigraphStream(ms);

            IEnumerable <char> enumerable = ts.GetCharEnumerable();
            IEnumerator <char> i          = enumerable.GetEnumerator();

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 's');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 'a');
        }
Пример #2
0
        public void TestTrigraphStreamNewlines()
        {
            // test Windows/Mac OSX line endings.
            String code = "s\r\na";
            char   ch;

            MemoryStream   ms = new MemoryStream(Encoding.ASCII.GetBytes(code));
            TrigraphStream ts = new TrigraphStream(ms);

            IEnumerable <char> enumerable = ts.GetCharEnumerable();
            IEnumerator <char> i          = enumerable.GetEnumerator();

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 's');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 'a');
        }