Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2001-09-28 05:40:11 +0400
committerMiguel de Icaza <miguel@gnome.org>2001-09-28 05:40:11 +0400
commit786f8547f0d2f75ee87f502ccc359e781a33f9ba (patch)
tree4ce94343b0ff6bf616a4dbf4020ca606ba4e4058 /mcs/tests/test-12.cs
parent744466b59b2a4dc850babc60e1d8a804213e2f1a (diff)
Add new test
svn path=/trunk/mcs/; revision=1019
Diffstat (limited to 'mcs/tests/test-12.cs')
-rw-r--r--mcs/tests/test-12.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/mcs/tests/test-12.cs b/mcs/tests/test-12.cs
new file mode 100644
index 00000000000..b788eb89dd1
--- /dev/null
+++ b/mcs/tests/test-12.cs
@@ -0,0 +1,44 @@
+/*
+ * Tests the ?: operator and the string concatenation
+ */
+
+using System;
+class X {
+ static int Main (string [] args)
+ {
+ string a = "hello";
+ string b = "1";
+ string c = a + b;
+ string d = a + 1;
+ string y;
+
+ if (c != d)
+ return 1;
+ if (d != (a + b))
+ return 2;
+ if (d != x (a, b))
+ return 3;
+ if (d != x (a, 1))
+ return 4;
+
+ y = c == d ? "equal" : "not-equal";
+ if (y != "equal")
+ return 5;
+ y = b == a ? "oops" : "nice";
+ if (y != "nice")
+ return 6;
+
+ Console.WriteLine (c);
+ return 0;
+ }
+
+ static string s (string a, int o)
+ {
+ return a + o;
+ }
+ static string x (string s, object o)
+ {
+ return s + o;
+ }
+
+}