示例#1
0
 public void TestEscapes()
 {
     Assert.AreEqual(Patterns.CharClass(LineFeed, 'a').Expression, @"[\na]");
     Assert.AreEqual(Patterns.CharClass(CarriageReturn, 'a').Expression, @"[\ra]");
     Assert.AreEqual(Patterns.CharClass(Digit, 'a').Expression, @"[\da]");
     Assert.AreEqual(Patterns.CharClass(NonDigit, 'a').Expression, @"[\Da]");
     Assert.AreEqual(Patterns.CharClass(AnyWordChar, 'a').Expression, @"[\wa]");
     Assert.AreEqual(Patterns.CharClass(NonWordChar, 'a').Expression, @"[\Wa]");
     Assert.AreEqual(Patterns.CharClass(Bell, 'a').Expression, @"[\aa]");
     Assert.AreEqual(Patterns.CharClass(Alarm, 'a').Expression, @"[\aa]");
     Assert.AreEqual(Patterns.CharClass(Backspace, 'a').Expression, @"[\ba]");
     Assert.AreEqual(Patterns.CharClass(Tab, 'a').Expression, @"[\ta]");
     Assert.AreEqual(Patterns.CharClass(VerticalTab, 'a').Expression, @"[\va]");
     Assert.AreEqual(Patterns.CharClass(FormFeed, 'a').Expression, @"[\fa]");
     Assert.AreEqual(Patterns.CharClass(WhiteSpace, 'a').Expression, @"[\sa]");
     Assert.AreEqual(Patterns.CharClass(NonWhiteSpace, 'a').Expression, @"[\Sa]");
     Assert.AreEqual(Patterns.CharClass(Escape, 'a').Expression, @"[\ea]");
     Assert.AreEqual(Patterns.CharClass(Hat, 'a').Expression, @"[\^a]");
     Assert.AreEqual(Patterns.CharClass(Minus, 'a').Expression, @"[\-a]");
     Assert.AreEqual(Patterns.CharClass(OpenSquareBracket, 'a').Expression, @"[\[a]");
     Assert.AreEqual(Patterns.CharClass(BackSlash, 'a').Expression, @"[\\a]");
 }