IsMissingNewlineAtEnd() public method

Determine if the file ends with a LF ('\n').
Determine if the file ends with a LF ('\n').
public IsMissingNewlineAtEnd ( ) : bool
return bool
Beispiel #1
0
        public virtual void LineDelimiterStartingWithCharacterReturn()
        {
            var rt = new RawText(Constants.EncodeASCII("\nfoo"));

            NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
        }
Beispiel #2
0
        public virtual void TestLineDelimiter()
        {
            RawText rt = new RawText(Constants.EncodeASCII("foo\n"));

            NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo\r\n"));
            NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo\nbar"));
            NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo\r\nbar"));
            NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo\nbar\r\n"));
            NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo\r\nbar\n"));
            NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("foo"));
            NUnit.Framework.Assert.IsNull(rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII(string.Empty));
            NUnit.Framework.Assert.IsNull(rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("\n"));
            NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
            rt = new RawText(Constants.EncodeASCII("\r\n"));
            NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
            NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
        }
Beispiel #3
0
 private bool IsEndOfLineMissing(RawText text, int line)
 {
     return(line + 1 == text.Size() && text.IsMissingNewlineAtEnd());
 }
Beispiel #4
0
 public virtual void LineDelimiterStartingWithCharacterReturn()
 {
     var rt = new RawText(Constants.EncodeASCII("\nfoo"));
     NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
 }
Beispiel #5
0
 public virtual void TestLineDelimiter()
 {
     RawText rt = new RawText(Constants.EncodeASCII("foo\n"));
     NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo\r\n"));
     NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo\nbar"));
     NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo\r\nbar"));
     NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo\nbar\r\n"));
     NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo\r\nbar\n"));
     NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("foo"));
     NUnit.Framework.Assert.IsNull(rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII(string.Empty));
     NUnit.Framework.Assert.IsNull(rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsTrue(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("\n"));
     NUnit.Framework.Assert.AreEqual("\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
     rt = new RawText(Constants.EncodeASCII("\r\n"));
     NUnit.Framework.Assert.AreEqual("\r\n", rt.GetLineDelimiter());
     NUnit.Framework.Assert.IsFalse(rt.IsMissingNewlineAtEnd());
 }