public void MissingRegex() { var cmd = new Cmd.Grep(); base.InitCommand(cmd); cmd.Input = "Lorem ipsum"; CommandResult result = cmd.Run(); Assert.AreEqual(CommandStatus.Failure, result.Status); }
public void InStringsRegexNumber() { var cmd = new Cmd.Grep(); base.InitCommand(cmd); cmd.Regex = "\\d"; cmd.Input = "Line 1\r\nLine Two\r\nLine Three"; CommandResult result = cmd.Run(); Assert.AreEqual(CommandStatus.Success, result.Status); Assert.AreEqual("Line 1", result.Message.Trim()); }
public void NoMatches() { var cmd = new Cmd.Grep(); base.InitCommand(cmd); cmd.Regex = "-"; cmd.Input = "Line 1\r\nLine Two\r\nLine Three"; CommandResult result = cmd.Run(); Assert.AreEqual(CommandStatus.Success, result.Status); Assert.AreEqual(string.Empty, result.Message.Trim()); }
public void InStrings() { var cmd = new Cmd.Grep(); base.InitCommand(cmd); cmd.Regex = "\\bc.+"; cmd.Input = "Contains matched line\r\nNo match\r\nNo match\r\nContains"; CommandResult result = cmd.Run(); Assert.AreEqual(CommandStatus.Success, result.Status); Assert.AreEqual("Contains matched line\r\nContains", result.Message.Trim()); }