[eglib] Prefer <langinfo.h> to <localcharset.h>
[mono.git] / mcs / tests / test-interpolation-02.cs
1 using System;
2 using System.Linq.Expressions;
3
4 namespace System
5 {
6         public class FormattableString
7         {
8                 public FormattableString (string str, object[] arguments)
9                 {
10                         Value = str;
11                         Arguments = arguments;
12                 }
13
14                 public string Value { get; set; }
15                 public object[] Arguments;
16         }
17 }
18
19 namespace System.Runtime.CompilerServices
20 {
21         public static class FormattableStringFactory
22         {
23                 public static object Create(string format, params object[] arguments)
24                 {
25                         if (format.StartsWith ("format"))
26                                 return new MyFormattable ();
27
28                         return new FormattableString (format, arguments);
29                 }
30         }
31 }
32
33 class MyFormattable : IFormattable
34 {
35         string IFormattable.ToString (string str, IFormatProvider provider)
36         {
37                 return null;
38         }
39 }
40
41 class ConversionTest
42 {
43         static int Main ()
44         {
45                 byte b = 3;
46
47                 FormattableString c1;
48                 c1 = $"{b}";
49                 if (c1.Value != "{0}")
50                         return 1;
51
52                 IFormattable c2;
53                 c2 = $"format { b }";
54                 if (!(c2 is MyFormattable))
55                         return 2;
56
57                 return 0;
58         }
59 }