Skip to content

Commit

Permalink
New test.
Browse files Browse the repository at this point in the history
svn path=/trunk/mcs/; revision=141620
  • Loading branch information
marek-safar committed Sep 9, 2009
1 parent 8780658 commit 2f11101
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions mcs/tests/gtest-462.cs
@@ -0,0 +1,31 @@
using System;

class Program
{
static int Main ()
{
Tester<int> t = new Tester<int> ();
int r = t.Get (333);
Console.WriteLine (r);
if (r != 333)
return 1;

r = t.Get (222.12);
Console.WriteLine (r);
if (r != 0)
return 2;

return 0;
}

class Tester<T> where T : struct, IConvertible
{
public T Get (object data)
{
var val = data;
if (val is T)
return (T) val;
return default (T);
}
}
}
18 changes: 18 additions & 0 deletions mcs/tests/ver-il-gmcs.xml
Expand Up @@ -11851,6 +11851,24 @@
</method>
</type>
</test>
<test name="gtest-462.cs">
<type name="Program">
<method name="Int32 Main()">
<size>79</size>
</method>
<method name="Void .ctor()">
<size>7</size>
</method>
</type>
<type name="Program+Tester`1[T]">
<method name="T Get(System.Object)">
<size>30</size>
</method>
<method name="Void .ctor()">
<size>7</size>
</method>
</type>
</test>
<test name="gtest-anon-1.cs">
<type name="X">
<method name="Void .ctor()">
Expand Down

0 comments on commit 2f11101

Please sign in to comment.