diff options
author | Wes Haggard <weshaggard@users.noreply.github.com> | 2017-01-25 22:08:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-25 22:08:01 +0300 |
commit | 9f00738f44164150f9b31cff5c72c19ebb68bb88 (patch) | |
tree | 65d09d8868fb1af08427ded8533e6514eaaa91e1 /src/System.Runtime | |
parent | 8c8c4eb0baf1c0b55ee6c8ef1f54aa70d339e8d5 (diff) | |
parent | 0a030699a75b6e6c80745a29e743758115630df6 (diff) |
Merge pull request #15334 from justinvp/string_trim_tests
Expose String.Trim overloads that take a single char
Diffstat (limited to 'src/System.Runtime')
-rw-r--r-- | src/System.Runtime/ref/System.Runtime.cs | 3 | ||||
-rw-r--r-- | src/System.Runtime/tests/System/StringTests.cs | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index a2ee903240..ebbf6df23b 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -2099,8 +2099,11 @@ namespace System public System.String ToUpper(System.Globalization.CultureInfo culture) { throw null; } public string ToUpperInvariant() { throw null; } public string Trim() { throw null; } + public string Trim(char trimChar) { throw null; } public string Trim(params char[] trimChars) { throw null; } + public string TrimEnd(char trimChar) { throw null; } public string TrimEnd(params char[] trimChars) { throw null; } + public string TrimStart(char trimChar) { throw null; } public string TrimStart(params char[] trimChars) { throw null; } } public enum StringComparison diff --git a/src/System.Runtime/tests/System/StringTests.cs b/src/System.Runtime/tests/System/StringTests.cs index db92512b29..39d0300e89 100644 --- a/src/System.Runtime/tests/System/StringTests.cs +++ b/src/System.Runtime/tests/System/StringTests.cs @@ -2313,6 +2313,12 @@ namespace System.Tests { Assert.Equal(expected, s.Trim()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.Trim(trimChars[0])); + } + Assert.Equal(expected, s.Trim(trimChars)); } @@ -2331,6 +2337,12 @@ namespace System.Tests { Assert.Equal(expected, s.TrimEnd()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.TrimEnd(trimChars[0])); + } + Assert.Equal(expected, s.TrimEnd(trimChars)); } @@ -2349,6 +2361,12 @@ namespace System.Tests { Assert.Equal(expected, s.TrimStart()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.TrimStart(trimChars[0])); + } + Assert.Equal(expected, s.TrimStart(trimChars)); } |