2002-08-05 Martin Baulig <martin@gnome.org>
[mono.git] / mcs / tests / test-12.cs
1 /*
2  * Tests the ?: operator and the string concatenation
3  */
4
5 using System;
6 class X {
7         static int Main (string [] args)
8         {
9                 string a = "hello";
10                 string b = "1";
11                 string c = a + b;
12                 string d = a + 1;
13                 string y;
14                 
15                 if (c != d)
16                         return 1;
17                 if (d != (a + b))
18                         return 2;
19                 if (d != x (a, b))
20                         return 3;
21                 if (d != x (a, 1))
22                         return 4;
23
24                 y = c == d ? "equal" : "not-equal";
25                 if (y != "equal")
26                         return 5;
27                 y = b == a ? "oops" : "nice";
28                 if (y != "nice")
29                         return 6;
30                 
31                 Console.WriteLine (c);
32                 return 0;
33         }
34
35         static string s (string a, int o)
36         {
37                 return a + o;
38         }
39         static string x (string s, object o)
40         {
41                 return s + o;
42         }
43
44 }