소스 검색

Add new test

svn path=/trunk/mcs/; revision=1019
Miguel de Icaza 24 년 전
부모
커밋
786f8547f0
2개의 변경된 파일45개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      mcs/tests/makefile
  2. 44 0
      mcs/tests/test-12.cs

+ 1 - 1
mcs/tests/makefile

@@ -2,7 +2,7 @@ MCS=../mcs/compiler
 CSC=csc
 
 TEST_SOURCES = \
-	test-1 test-4 test-6 test-7 test-8 test-9 test-10 test-11
+	test-1 test-4 test-6 test-7 test-8 test-9 test-10 test-11 test-12
 
 TEST_NOPASS = \
 	test-2 test-3 test-5

+ 44 - 0
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;
+	}
+
+}