Skip to content

Commit

Permalink
[corlib] Initialize null stream reader
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Feb 4, 2014
1 parent 2783684 commit d3b817c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mcs/class/corlib/System.IO/StreamReader.cs
Expand Up @@ -44,6 +44,11 @@ public class StreamReader : TextReader
{
sealed class NullStreamReader : StreamReader
{
internal NullStreamReader ()
{
base_stream = Stream.Null;
}

public override int Peek ()
{
return -1;
Expand Down
7 changes: 7 additions & 0 deletions mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
Expand Up @@ -838,6 +838,13 @@ public void EncodingChangedAuto ()
}
}

[Test]
public void NullStream ()
{
var buffer = new char[2];
Assert.AreEqual (0, StreamReader.Null.ReadBlock (buffer, 0, buffer.Length));
}

#if NET_4_5
[Test]
public void ReadLineAsync ()
Expand Down

0 comments on commit d3b817c

Please sign in to comment.