2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / w32message.cs
blob5ff5d3a1e727fe7cb697368fc1b98ef4e510cbb1
1 //
2 // This test merely creates a Win32Exception that triggers the
3 // code in mono/io-layer/message.c that validates that the
4 // error table is propertly sorted
5 //
6 // If there is output on stderr, we have an error
7 //
8 using System;
9 using System.ComponentModel;
11 class X {
12 static string msg (int c)
14 return new Win32Exception (c).Message;
17 static void check (int c, string s)
19 if (msg (c) != s)
20 Console.WriteLine ("For {0} expected {1} got {2}", c, s, msg (c));
23 static void Main ()
26 // All this test does is instantiate two Win32Exceptions
27 // one with no known text, so it triggers a linear search
28 // And one with a known message, to trigger a validation
30 // If stderr gets any output, there is a sorting error
31 // in mono/io-layer/messages.c
33 Exception a = new Win32Exception (99999);
34 a = new Win32Exception (9805);
36 check (2, "Cannot find the specified file");