Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CreateGUIDVSPlugin/Utility/ProcessTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ProcessTemplate
/// <summary>
/// instance of regular expression
/// </summary>
static private Regex reg = new Regex(regexStr);
static internal Regex reg = new Regex(regexStr);

/// <summary>
/// definition of delegate
Expand Down
30 changes: 30 additions & 0 deletions UnitTests/TestProcessTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ public void TearDown()
{
}

[TestCase("Variable1", true)]
[TestCase("Variable_5", true)]
[TestCase("Variable1(2)", true)]
[TestCase("Variable2(123)", true)]
[TestCase("Variable1(a)", false)]
[TestCase("Variable2(ef)", false)]
[TestCase("Variable1(123d)", false)]
[TestCase("Variable2(-123)", false)]
[TestCase("Variable3(+123)", false)]
[TestCase("Variable4(d123)", false)]
[TestCase("Variable-1", false)]
[TestCase("Variable+1", false)]
[TestCase("Variable 1", false)]
[TestCase("Variable,1", false)]
[TestCase("Variable.1", false)]
[TestCase("Variable[1", false)]
[TestCase("Variable[1", false)]
[TestCase("Variable(1", false)]
[TestCase("Variable1)", false)]
[TestCase("[Variable1]", false)]
public void Test_RegEx(string inputKeyword, bool expected)
{
var input = "{" + inputKeyword + "}";
var output = ProcessTemplate.reg.Match(input);
Console.WriteLine("input : " + input);
Console.WriteLine("output : " + output.Success);
Console.WriteLine("expected: " + expected);
Assert.That(output.Success, Is.EqualTo(expected));
}

[TestCase("Variable1", "VariableA")]
[TestCase("Variable2", "VariableB")]
[TestCase("Variable3", "VariableC")]
Expand Down