Turn eval test into normal test case
authorMarek Safar <marek.safar@gmail.com>
Thu, 29 Apr 2010 09:00:15 +0000 (09:00 -0000)
committerMarek Safar <marek.safar@gmail.com>
Thu, 29 Apr 2010 09:00:15 +0000 (09:00 -0000)
svn path=/trunk/mcs/; revision=156404

1  2 
mcs/tests/Makefile
mcs/tests/eval-test.cs
mcs/tests/gtest-repl-01.cs
mcs/tests/ver-il-gmcs.xml

index d9e017dc510f945c088f5a9f5986dfcf42101955,9170cb295323a2b85a0d6faf37793b25bbd86932..c901784e6184dd0965e2c88c451412437b6f8481
@@@ -44,8 -44,8 +44,6 @@@ test-casts: boot-casts.out mcs-casts.ou
        cmp $^
        -rm -f bootstrap-cast.exe casts.cs casts-boot.exe casts-mcs.exe boot-casts.out mcs-casts.out
  
--eval.exe: eval-tests.cs
--
  ifeq (net_4_0, $(PROFILE))
  COMPILER_NAME = dmcs
  TEST_PATTERN = 'v4'
@@@ -71,14 -71,14 +69,10 @@@ TESTER = MONO_RUNTIME='$(RUNTIME)' $(TE
  
  TEST_ILS := $(wildcard *-lib.il)
  
--eval-test: 
--      $(CSCOMPILE) eval-test.cs -r:Mono.CSharp.dll
--      $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) eval-test.exe
--
  build-compiler-lib:
        cd ../class/Mono.CSharp && $(MAKE) NO_DIR_CHECK=yes
  
--qcheck: build-compiler-lib eval-test
++qcheck: build-compiler-lib
        $(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(COMPILER_NAME) -log:$(COMPILER_NAME).log $(TOPTIONS) $(DEFINES)
  
  test-local:
diff --cc mcs/tests/eval-test.cs
index c9433a4f262f7d6d8b19115f4554c5e94e2d567a,c9433a4f262f7d6d8b19115f4554c5e94e2d567a..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,95 -1,95 +1,0 @@@
--using System;
--using Mono.CSharp;
--
--public class MyTest {
--      static void Run (string id, string stmt)
--      {
--              if (!Evaluator.Run (stmt))
--                      Console.WriteLine ("Failed on test {0}", id);
--      }
--
--      static void Evaluate (string id, string expr, object expected)
--      {
--              try {
--                      object res = Evaluator.Evaluate (expr);
--                      if (res == null && expected == null)
--                              return;
--
--                      if (!expected.Equals (res)){
--                              Console.WriteLine ("Failed on test {2} Expecting {0}, got {1}", expected, res, id);
--                              throw new Exception ();
--                      }
--              } catch {
--                      Console.WriteLine ("Failed on test {0}", id);
--                      throw;
--              }
--      }
--      
--      static void Main ()
--      {
--              Evaluator.Init (new string [0]); //new string [] { "-v", "-v" });
--              //
--              // This fails because of the grammar issue with the pointer type
--              // Evaluate ("multiply", "1*2;", 2);
--              //
--              Run ("1",      "System.Console.WriteLine (100);");
--              Run ("Length", "var a = new int [] {1,2,3}; var b = a.Length;");
--              
--              Evaluate ("CompareString", "\"foo\" == \"bar\";", false);
--              Evaluate ("CompareInt", "var a = 1; a+2;", 3);
--
--              Evaluator.Run ("using System; using System.Linq;");
--              Run ("LINQ-1", "var a = new int[]{1,2,3};\nfrom x in a select x;");
--              Run ("LINQ-2", "var a = from f in System.IO.Directory.GetFiles (\"/tmp\") where f == \"passwd\" select f;");
--
--              Evaluator.ReferenceAssembly (typeof (MyTest).Assembly);
--              Evaluate ("assembly reference test", "typeof (MyTest) != null;", true);
--
--              Run ("LINQ-3", "var first_scope = new int [] {1,2,3};");
--              Run ("LINQ-4", "var second_scope = from x in first_scope select x;");
--
--              string prefix = "";
--              string [] res = Evaluator.GetCompletions ("ConsoleK", out prefix);
--              if (res [0] != "ey" || res [1] != "eyInfo"){
--                      Console.WriteLine (res [0]);
--                      Console.WriteLine (res [1]);
--                      throw new Exception ("Expected two completions ConsoleKey and ConsoleKeyInfo");
--              }
--
--              res = Evaluator.GetCompletions ("Converte", out prefix);
--              if (res [0] != "r"){
--                      throw new Exception ("Expected one completion for Converter");
--              }
--
--              res = Evaluator.GetCompletions ("Sys", out prefix);
--              if (res [0] != "tem"){
--                      throw new Exception ("Expected at least a conversion for System");
--              }
--
--              res = Evaluator.GetCompletions ("System.Int3", out prefix);
--              if (res [0] != "2"){
--                      throw new Exception ("Expected completion to System.Int32");
--              }
--
--              res = Evaluator.GetCompletions ("new System.Text.StringBuilder () { Ca", out prefix);
--              if (res [0] != "pacity"){
--                      throw new Exception ("Expected completion to Capacity");
--              }
--
--              res = Evaluator.GetCompletions ("new System.Text.StringBuilder () { ", out prefix);
--              if (res.Length != 3){
--                      throw new Exception ("Epxected 4 completions (Capacity Chars Length MaxCapacity)");
--              }
--
--              // These should return "partial"
--              object eval_result;
--              bool result_set;
--              string sres  = Evaluator.Evaluate ("1+", out eval_result, out result_set);
--              if (result_set)
--                      throw new Exception ("No result should have been set");
--              if (sres != "1+")
--                      throw new Exception ("The result should have been the input string, since we have a partial input");
--              
--      }
--      
--}
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..1092456a52e0bed51ce2310b4a1da33bce90f82c
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,96 @@@
++// Compiler options: -r:Mono.CSharp.dll
++
++using System;
++using Mono.CSharp;
++
++public class MyTest {
++      static void Run (string id, string stmt)
++      {
++              if (!Evaluator.Run (stmt))
++                      Console.WriteLine ("Failed on test {0}", id);
++      }
++
++      static void Evaluate (string id, string expr, object expected)
++      {
++              try {
++                      object res = Evaluator.Evaluate (expr);
++                      if (res == null && expected == null)
++                              return;
++
++                      if (!expected.Equals (res)){
++                              Console.WriteLine ("Failed on test {2} Expecting {0}, got {1}", expected, res, id);
++                              throw new Exception ();
++                      }
++              } catch {
++                      Console.WriteLine ("Failed on test {0}", id);
++                      throw;
++              }
++      }
++      
++      static void Main ()
++      {
++              Evaluator.Init (new string [0]); //new string [] { "-v", "-v" });
++              //
++              // This fails because of the grammar issue with the pointer type
++              // Evaluate ("multiply", "1*2;", 2);
++              //
++              Run ("1",      "System.Console.WriteLine (100);");
++              Run ("Length", "var a = new int [] {1,2,3}; var b = a.Length;");
++              
++              Evaluate ("CompareString", "\"foo\" == \"bar\";", false);
++              Evaluate ("CompareInt", "var a = 1; a+2;", 3);
++
++              Evaluator.Run ("using System; using System.Linq;");
++              Run ("LINQ-1", "var a = new int[]{1,2,3};\nfrom x in a select x;");
++              Run ("LINQ-2", "var a = from f in System.IO.Directory.GetFiles (\"/tmp\") where f == \"passwd\" select f;");
++
++              Evaluator.ReferenceAssembly (typeof (MyTest).Assembly);
++              Evaluate ("assembly reference test", "typeof (MyTest) != null;", true);
++
++              Run ("LINQ-3", "var first_scope = new int [] {1,2,3};");
++              Run ("LINQ-4", "var second_scope = from x in first_scope select x;");
++
++              string prefix = "";
++              string [] res = Evaluator.GetCompletions ("ConsoleK", out prefix);
++              if (res [0] != "ey" || res [1] != "eyInfo"){
++                      Console.WriteLine (res [0]);
++                      Console.WriteLine (res [1]);
++                      throw new Exception ("Expected two completions ConsoleKey and ConsoleKeyInfo");
++              }
++
++              res = Evaluator.GetCompletions ("Converte", out prefix);
++              if (res [0] != "r"){
++                      throw new Exception ("Expected one completion for Converter");
++              }
++
++              res = Evaluator.GetCompletions ("Sys", out prefix);
++              if (res [0] != "tem"){
++                      throw new Exception ("Expected at least a conversion for System");
++              }
++
++              res = Evaluator.GetCompletions ("System.Int3", out prefix);
++              if (res [0] != "2"){
++                      throw new Exception ("Expected completion to System.Int32");
++              }
++
++              res = Evaluator.GetCompletions ("new System.Text.StringBuilder () { Ca", out prefix);
++              if (res [0] != "pacity"){
++                      throw new Exception ("Expected completion to Capacity");
++              }
++
++              res = Evaluator.GetCompletions ("new System.Text.StringBuilder () { ", out prefix);
++              if (res.Length != 3){
++                      throw new Exception ("Epxected 4 completions (Capacity Chars Length MaxCapacity)");
++              }
++
++              // These should return "partial"
++              object eval_result;
++              bool result_set;
++              string sres  = Evaluator.Evaluate ("1+", out eval_result, out result_set);
++              if (result_set)
++                      throw new Exception ("No result should have been set");
++              if (sres != "1+")
++                      throw new Exception ("The result should have been the input string, since we have a partial input");
++              
++      }       
++}
index 407fca6c19440da01eb9041fd7a3f0a2996b057b,259b8bfde02e19438baf2aeab0db82f410537e27..2556773c9ff5eed3acf93ac869a1dd167c404b03
        </method>
      </type>
    </test>
 +  <test name="gtest-etree-22.cs">
 +    <type name="FieldInfoBug.MonoRuntime">
 +      <method name="Int32 Main()">
 +        <size>13</size>
 +      </method>
 +      <method name="Void .ctor()">
 +        <size>7</size>
 +      </method>
 +    </type>
 +    <type name="FieldInfoBug.GenericClass`1[T]">
 +      <method name="Void .ctor(String)">
 +        <size>58</size>
 +      </method>
 +    </type>
 +    <type name="FieldInfoBug.GenericClass`1+&lt;GenericClass&gt;c__AnonStorey0[T]">
 +      <method name="Void .ctor()">
 +        <size>7</size>
 +      </method>
 +    </type>
 +  </test>
++  <test name="gtest-etree-23.cs">
++    <type name="Test.OrderBySpecification">
++      <method name="Void .ctor(Expression`1)">
++        <size>7</size>
++      </method>
++    </type>
++    <type name="Test.RateOrderById">
++      <method name="Int32 Main()">
++        <size>8</size>
++      </method>
++      <method name="Void .ctor()">
++        <size>44</size>
++      </method>
++    </type>
++  </test>
    <test name="gtest-exmethod-01.cs">
      <type name="SimpleTest">
        <method name="System.String Prefix(System.String, System.String)">
          <size>1</size>
        </method>
        <method name="Void .ctor()">
+         <size>7</size>
+       </method>
+     </type>
+   </test>
++  <test name="gtest-repl-01.cs">
++    <type name="MyTest">
++      <method name="Void Run(System.String, System.String)">
++        <size>23</size>
++      </method>
++      <method name="Void Evaluate(System.String, System.String, System.Object)">
++        <size>80</size>
++      </method>
++      <method name="Void Main()">
++        <size>540</size>
++      </method>
++      <method name="Void .ctor()">
 +        <size>7</size>
 +      </method>
 +    </type>
 +  </test>
    <test name="gtest-var-04.cs">
      <type name="Test">
        <method name="Void .ctor()">