|
1 | 1 | using System;
|
| 2 | +using System.Globalization; |
2 | 3 | using System.Text;
|
3 | 4 |
|
4 | 5 | class FormatInvalid
|
@@ -134,5 +135,27 @@ void FormatMethodTests()
|
134 | 135 | ts.TraceInformation("{0}"); // GOOD
|
135 | 136 | }
|
136 | 137 |
|
| 138 | + void CompositeFormatMethods() |
| 139 | + { |
| 140 | + var format = CompositeFormat.Parse("}"); // $ Alert |
| 141 | + |
| 142 | + // GOOD: Format is invalid and this flagged during parsing. |
| 143 | + String.Format<string>(null, format, ""); |
| 144 | + String.Format<string, string>(null, format, "", ""); |
| 145 | + String.Format<string, string, string>(null, format, "", "", ""); |
| 146 | + |
| 147 | + sb.AppendFormat(null, format, ""); |
| 148 | + sb.AppendFormat<string>(null, format, ""); |
| 149 | + sb.AppendFormat<string, string>(null, format, "", ""); |
| 150 | + sb.AppendFormat<string, string, string>(null, format, "", "", ""); |
| 151 | + |
| 152 | + |
| 153 | + var span = new Span<char>(); |
| 154 | + span.TryWrite(null, format, out _); |
| 155 | + span.TryWrite<object>(null, format, out _, new object()); |
| 156 | + span.TryWrite<object, object>(null, format, out _, new object(), new object()); |
| 157 | + span.TryWrite<object, object, object>(null, format, out _, "", "", ""); |
| 158 | + } |
| 159 | + |
137 | 160 | System.IO.StringWriter sw;
|
138 | 161 | }
|
0 commit comments