This repository was archived by the owner on Jun 5, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed
Framework/Subset_of_CorLib/System
Test/Platform/Tests/CLR/mscorlib/systemlib/systemlib2 Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -228,12 +228,10 @@ public static String Concat(params Object[] args)
228228
229229 int length = args . Length ;
230230 String [ ] sArgs = new String [ length ] ;
231- int totalLength = 0 ;
232231
233232 for ( int i = 0 ; i < length ; i ++ )
234233 {
235234 sArgs [ i ] = ( ( args [ i ] == null ) ? ( String . Empty ) : ( args [ i ] . ToString ( ) ) ) ;
236- totalLength += sArgs [ i ] . Length ;
237235 }
238236
239237 return String . Concat ( sArgs ) ;
Original file line number Diff line number Diff line change @@ -436,6 +436,35 @@ public MFTestResults Length_Test71()
436436 testResult &= ( str1 . Length == 9 ) ;
437437 return ( testResult ? MFTestResults . Pass : MFTestResults . Fail ) ;
438438 }
439-
439+
440+ [ TestMethod ]
441+ public MFTestResults Concat_Test1 ( )
442+ {
443+ /// <summary>
444+ /// 1. Tests the string concat of several object where one of the arguments returns a null value for ToString()
445+ /// </summary>
446+ ///
447+
448+ try
449+ {
450+ string str = "a" + 1 + "b" + new ToStringReturnsNull ( ) ;
451+ return ( str == "a1b" ? MFTestResults . Pass : MFTestResults . Fail ) ;
452+ }
453+ catch
454+ {
455+ return MFTestResults . Fail ;
456+ }
457+ }
458+ }
459+
460+ /// <summary>
461+ /// A class whose ToString method return null
462+ /// </summary>
463+ public class ToStringReturnsNull
464+ {
465+ public override string ToString ( )
466+ {
467+ return null ;
468+ }
440469 }
441470}
You can’t perform that action at this time.
0 commit comments