public void TestSeparateAccentedCharacters() { var builder = new DfaBuilder <AccentedChar>(); builder.AddPattern(Pattern.Match("Les Mise\u0301rables"), AccentedChar.Miserable); var searcher = builder.BuildStringSearcher(null); var instr = "Les Mise\u0301rables"; var want = "[Miserable=Les Mise\u0301rables]"; var have = searcher.FindAndReplace(instr, TokenReplace); Assert.Equal(want, have); }
public void TestSingleToken() { var builder = new DfaBuilder <JavaToken>(); foreach (JavaToken tok in Enum.GetValues(typeof(JavaToken))) { builder.AddPattern(tok.Pattern(), tok); } var searcher = builder.BuildStringSearcher(null); var instr = "this"; var want = "[THIS=this]"; var have = searcher.FindAndReplace(instr, TokenReplace); Assert.Equal(want, have); }
public void Test() { var builder = new DfaBuilder <JavaToken>(); foreach (JavaToken tok in Enum.GetValues(typeof(JavaToken))) { builder.AddPattern(tok.Pattern(), tok); } var searcher = builder.BuildStringSearcher(null); var instr = ReadResource("SearcherTestInput.txt"); var want = ReadResource("SearcherTestOutput.txt"); var have = searcher.FindAndReplace(instr, TokenReplace); Assert.Equal(want, have); }