コード例 #1
0
ファイル: ErrorTest.cs プロジェクト: SilentCC/ICU4N
        public void TestRBTErrors()
        {
            String     rules       = "ab>y";
            String     id          = "MyRandom-YReverse";
            String     goodPattern = "[[:L:]&[\\u0000-\\uFFFF]]"; /* all BMP letters */
            UnicodeSet set         = null;

            try
            {
                set = new UnicodeSet(goodPattern);
                try
                {
                    Transliterator t =
                        Transliterator.CreateFromRules(id, rules, Transliterator.REVERSE);
                    t.Filter = (set);
                    Transliterator.RegisterClass(id, t.GetType(), null);
                    Transliterator.Unregister(id);
                    try
                    {
                        Transliterator.GetInstance(id, Transliterator.REVERSE);
                        Errln("FAIL: construction of unregistered ID should have failed.");
                    }
                    catch (ArgumentException e)
                    {
                    }
                }
                catch (ArgumentException e)
                {
                    Errln("FAIL: Was not able to create a good RBT to test registration.");
                }
            }
            catch (ArgumentException e)
            {
                Errln("FAIL: Was not able to create a good UnicodeSet based on valid patterns.");
                return;
            }
        }