You've already forked linux-packaging-mono
Imported Upstream version 6.12.0.86
Former-commit-id: 7a84ce7d08c42c458ac8e74b27186ca863315d79
This commit is contained in:
parent
92747312ea
commit
0b380204a4
@@ -311,8 +311,8 @@ public class UnixEncoding : Encoding
|
||||
|
||||
public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
|
||||
{
|
||||
if (bytes == null || chars == null)
|
||||
throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
|
||||
if ((bytes == null && byteCount != 0) || (chars == null && charCount != 0))
|
||||
throw new ArgumentNullException ((bytes == null && byteCount != 0) ? "bytes" : "chars");
|
||||
|
||||
if (charCount < 0 || byteCount < 0)
|
||||
throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
|
||||
|
||||
@@ -995,6 +995,23 @@ namespace MonoTests.Mono.Unix {
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyString ()
|
||||
{
|
||||
byte[] data = new byte [] {};
|
||||
Encoding enc = new UnixEncoding ();
|
||||
|
||||
string s = enc.GetString (data);
|
||||
Assert.AreEqual (s, "", "#1");
|
||||
char[] chars = enc.GetChars (data);
|
||||
Assert.AreEqual (chars.Length, 0, "#2");
|
||||
|
||||
byte[] b1 = enc.GetBytes ("");
|
||||
Assert.AreEqual (b1.Length, 0, "#3");
|
||||
byte[] b2 = enc.GetBytes (new char[] {});
|
||||
Assert.AreEqual (b2.Length, 0, "#3");
|
||||
}
|
||||
|
||||
private void Compare (string prefix, string start, byte[] end)
|
||||
{
|
||||
byte[] bytes = unix.GetBytes (start);
|
||||
|
||||
Reference in New Issue
Block a user