Beispiel #1
0
 public void WhenSimpleRegex_ExpectSimpleResults(string expected, string line, string input)
 {
     ReplaceTokens engine = new ReplaceTokens() { sw = new WriteToString() };
     Command command = new Command(line);
     Assert.AreEqual(expected, engine.ApplySingleCommand(input, command));
 }
Beispiel #2
0
 public void WhenAnchorMatchesButPatternDoesNot_All_ExpectNoChange()
 {
     ReplaceTokens engine = new ReplaceTokens() { sw = new WriteToString() };
     Command command = new Command("/today/ Joe~to");
     Assert.AreEqual("you and you today", engine.ApplySingleCommand("you and you today", command));
 }
Beispiel #3
0
 public void WhenReplacmentSwapsGroups_All_ExpectChange()
 {
     ReplaceTokens engine = new ReplaceTokens() { sw = new WriteToString() };
     List<Command> reps = new List<Command>();
     Command command = new Command(@"(\w+)\s(\w+)~$2 $1");
     Assert.AreEqual("me from you to", engine.ApplySingleCommand("from me to you", command));
 }
Beispiel #4
0
 public void WhenAnchorAndPatternMatches_All_ExpectChange()
 {
     ReplaceTokens engine = new ReplaceTokens() { sw = new WriteToString() };
     Command command = new Command("/today/ you ~ to");
     Assert.AreEqual("to and to today", engine.ApplySingleCommand("you and you today", command));
 }