diff options
author | Marek Safar <marek.safar@gmail.com> | 2013-03-13 15:02:18 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2013-03-13 15:08:13 +0400 |
commit | 046b7a22c878c9bf9d664195d970da7b1b7114bf (patch) | |
tree | 05c67d3b69b0371f0fe83b77750b833ecd1cd299 /mcs/tests/test-49.cs | |
parent | 988f522b363ab959c331dc3b3d7693b6ecbad64b (diff) |
Resolve switch block without fake sections blocks. Fixes #10781
Diffstat (limited to 'mcs/tests/test-49.cs')
-rw-r--r-- | mcs/tests/test-49.cs | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/mcs/tests/test-49.cs b/mcs/tests/test-49.cs index c9aabd35775..9800ffd3d61 100644 --- a/mcs/tests/test-49.cs +++ b/mcs/tests/test-49.cs @@ -579,6 +579,76 @@ class X { switch (a) { } } + + static int LongStringSwitch (string s) + { + switch (s) + { + case "System": + case "System.Core": + case "System.Data": + case "System.Data.DataSetExtensions": + case "System.Data.Linq": + case "System.Data.OracleClient": + case "System.Data.Services": + case "System.Data.Services.Client": + case "System.IdentityModel": + case "System.IdentityModel.Selectors": + case "System.Runtime.Remoting": + case "System.Runtime.Serialization": + case "System.ServiceModel": + case "System.Transactions": + case "System.Windows.Forms": + case "System.Xml": + case "System.Xml.Linq": + return 1; + + case "System.Configuration": + case "System.Configuration.Install": + case "System.Design": + case "System.DirectoryServices": + case "System.Drawing": + case "System.Drawing.Design": + case "System.EnterpriseServices": + case "System.Management": + case "System.Messaging": + case "System.Runtime.Serialization.Formatters.Soap": + case "System.Security": + case "System.ServiceProcess": + case "System.Web": + case "System.Web.Mobile": + case "System.Web.Services": + return 2; + + case "System.ComponentModel.DataAnnotations": + case "System.ServiceModel.Web": + case "System.Web.Abstractions": + case "System.Web.Extensions": + case "System.Web.Extensions.Design": + case "System.Web.DynamicData": + case "System.Web.Routing": + return 3; + } + + return 10; + } + + static bool SwitchSingleSection (string scheme) + { + switch (scheme) { + case "http": + case "https": + case "file": + case "ftp": + case "nntp": + case "gopher": + case "mailto": + case "news": + return true; + default: + return false; + } + } public static int Main () { @@ -720,6 +790,20 @@ class X { if (tests2 ("two") != 3) return 73; + if (LongStringSwitch ("System.Management") != 2) + return 80; + if (LongStringSwitch (null) != 10) + return 81; + if (LongStringSwitch (".") != 10) + return 82; + + if (!SwitchSingleSection ("file")) + return 90; + if (SwitchSingleSection (null)) + return 91; + if (SwitchSingleSection ("-=-")) + return 92; + test_1597 (); Console.WriteLine ("All tests pass"); |