From 475f9af66a763c5d349b60706dd779d8c31cd56d Mon Sep 17 00:00:00 2001 From: Westermann Date: Thu, 18 Jul 2019 11:13:58 +0200 Subject: [PATCH] Add First Tests for regexp package --- Tests/GoldLibrary.Tests.Shared.projitems | 2 ++ Tests/RegexTests.go | 17 +++++++++++++++++ Tests/RegexTests.pas | 24 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Tests/RegexTests.go create mode 100644 Tests/RegexTests.pas diff --git a/Tests/GoldLibrary.Tests.Shared.projitems b/Tests/GoldLibrary.Tests.Shared.projitems index e2ab4a2..e20175e 100644 --- a/Tests/GoldLibrary.Tests.Shared.projitems +++ b/Tests/GoldLibrary.Tests.Shared.projitems @@ -36,5 +36,7 @@ + + \ No newline at end of file diff --git a/Tests/RegexTests.go b/Tests/RegexTests.go new file mode 100644 index 0000000..ab94eaa --- /dev/null +++ b/Tests/RegexTests.go @@ -0,0 +1,17 @@ +package GoldLibrary.Tests.Shared +import ( + "bytes" + "fmt" + "regexp" +) + + +func DoSimpleMatchTest() bool { + matched, _ := regexp.MatchString("foo.*", "seafood") + return matched +} + +func DoMustCompileTest() bool { + var validID = regexp.MustCompile(`^[a-z]+\[[0-9]+\]$`) + return validID.MatchString("adam[23]") +} \ No newline at end of file diff --git a/Tests/RegexTests.pas b/Tests/RegexTests.pas new file mode 100644 index 0000000..b71314d --- /dev/null +++ b/Tests/RegexTests.pas @@ -0,0 +1,24 @@ +namespace GoldLibrary.Tests.Shared; + +uses + RemObjects.Elements.EUnit, + RemObjects.Elements.RTL; + +type + RegeexTests = public class(Test) + + public + method SimpleMatchTest; + begin + Assert.IsTrue(TestApplication2.DoSimpleMatchTest()); + end; + + + method MustCompileTest; + begin + Assert.IsTrue(TestApplication2.DoMustCompileTest()); + end; + + end; + +end. \ No newline at end of file