Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit fd077b5

Browse files
committed
Merge pull request #150 from mortezag/fixStringCtor
Fix new String(new Char[0])
2 parents 778ad10 + fd43a48 commit fd077b5

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

CLR/Libraries/CorLib/corlib_native_System_String.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ HRESULT Library_corlib_native_System_String::FromCharArray( CLR_RT_StackFrame& s
548548
CLR_UINT32 len;
549549

550550
array = stack.Arg1().DereferenceArray(); if(!array) TINYCLR_SET_AND_LEAVE(S_OK);
551-
len = array->m_numOfElements ; if(!len ) TINYCLR_SET_AND_LEAVE(S_OK);
551+
len = array->m_numOfElements ;
552552

553553
if(length == -1) length = len - startIndex;
554554

Test/Platform/Tests/CLR/System/Text/StringBuilder/StringBuilderTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ public MFTestResults Test_1_RemoveTest_0()
129129

130130
bool result = false;
131131

132-
//result = stringBuilder.Clear().ToString() == string.Empty;
133-
result = stringBuilder.Clear().ToString() == null;
132+
result = stringBuilder.Clear().ToString() == string.Empty;
134133

135134
if (!result)
136135
{
@@ -429,8 +428,7 @@ public MFTestResults Test_4_CapacityTest_0()
429428

430429
bool result = false;
431430

432-
//result = stringBuilder.ToString() == string.Empty;
433-
result = stringBuilder.ToString() == null;
431+
result = stringBuilder.ToString() == string.Empty;
434432

435433
if (!result)
436434
{

Test/Platform/Tests/CLR/mscorlib/systemlib/systemlib2/SystemStringTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ public MFTestResults Ctor_Test()
5757
char[] car2 = new char[] { (char)0, (char)65};
5858
string s = new string(car2);
5959
testResult &= (s == "\0A");
60-
6160
Log.Comment("This was previously bug 20620");
61+
62+
Log.Comment("new char[0]");
63+
str = new string(new char[0]);
64+
testResult &= (str == string.Empty);
65+
6266
return (testResult ? MFTestResults.Pass : MFTestResults.Fail);
6367
}
6468
[TestMethod]

0 commit comments

Comments
 (0)