You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
@ -44,7 +44,7 @@ namespace MonoTests.System.Text
|
||||
byte [] bytes = new byte [10000];
|
||||
char [] chars = new char [10000];
|
||||
|
||||
Encoder conv = Encoding.UTF8.GetEncoder ();
|
||||
Encoder conv = new ExposedEncoder ();
|
||||
int bytesUsed, charsUsed;
|
||||
bool done;
|
||||
|
||||
@ -56,6 +56,25 @@ namespace MonoTests.System.Text
|
||||
Assert.AreEqual (625, charsUsed, "#3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConvertLimitedDestinationUTF8 ()
|
||||
{
|
||||
byte [] bytes = new byte [10000];
|
||||
char [] chars = new char [10000];
|
||||
|
||||
Encoder conv = Encoding.UTF8.GetEncoder ();
|
||||
var type = conv.GetType ();
|
||||
int bytesUsed, charsUsed;
|
||||
bool done;
|
||||
|
||||
conv.Convert (chars, 0, 10000, bytes, 0, 1000, true,
|
||||
out bytesUsed, out charsUsed, out done);
|
||||
|
||||
Assert.IsFalse (done, "#1");
|
||||
Assert.AreEqual (1000, bytesUsed, "#2");
|
||||
Assert.AreEqual (1000, charsUsed, "#3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CustomEncodingGetEncoder ()
|
||||
{
|
||||
@ -80,6 +99,18 @@ namespace MonoTests.System.Text
|
||||
Assert.AreEqual (0, bytesUsed, "#3");
|
||||
}
|
||||
|
||||
class ExposedEncoder : Encoder {
|
||||
public override int GetByteCount (char [] chars, int index, int count, bool flush)
|
||||
{
|
||||
return Encoding.UTF8.GetEncoder ().GetByteCount (chars, index, count, flush);
|
||||
}
|
||||
|
||||
public override int GetBytes (char [] chars, int charIndex, int charCount, byte [] bytes, int byteIndex, bool flush)
|
||||
{
|
||||
return Encoding.UTF8.GetEncoder ().GetBytes (chars, charIndex, charCount, bytes, byteIndex, flush);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomEncoding : Encoding {
|
||||
|
||||
public override int GetByteCount (char [] chars, int index, int count)
|
||||
|
Reference in New Issue
Block a user