[loader] Init MonoClass:sizes.element_size lazily (Fixes #43563) (#5559)
[mono.git] / mono / tests / switch-string.cs
index c264d1feb66a6041553fcdcf24074066962e547c..4cc45f884df9cb3cf493a9ae3122c5f590060539 100644 (file)
@@ -2,21 +2,31 @@ using System;
 
 public class fall_through {
 
-       public static void Main(string[] args)
-       {
-               foreach(string str in args)
-               {
-                       Console.WriteLine(str);
+       static void test (string str) {
+                       Console.WriteLine("testing: '{0}', interned: {1}", str, String.IsInterned(str) != null);
 
                        switch(str)
                        {
                                case "test":
                                        Console.WriteLine("passed");
-                                       continue;
+                                       break;
 
                                default:
                                        return;
                        }
+       }
+       public static void Main(string[] args)
+       {
+               char[] c = {'t', 'e', 's', 't'};
+               string s = new String (c);
+               string s2 = new String (c);
+               Console.WriteLine("testing built string (interned = {0}) (equal strings: {1})", String.IsInterned(s) != null, (object)s == (object)s2);
+               test (s);
+               Console.WriteLine("after test 1 (interned = {0}) (equal strings: {1})", String.IsInterned(s) != null, (object)s == (object)s2);
+               Console.WriteLine("after test (interned = {0}) (interned2 = {1})", String.IsInterned(s) != null, String.IsInterned(s2) != null);
+               foreach(string str in args)
+               {
+                       test (str);
                }
        }
 }