From 0c4f27688622053a35d5b14ad138a6cd0fba20c4 Mon Sep 17 00:00:00 2001 From: Pixel Date: Wed, 16 Nov 2011 20:54:36 -0800 Subject: Adding the Regex class. --- tests/test-Regex.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test-Regex.cc (limited to 'tests') diff --git a/tests/test-Regex.cc b/tests/test-Regex.cc new file mode 100644 index 0000000..b656445 --- /dev/null +++ b/tests/test-Regex.cc @@ -0,0 +1,21 @@ +#include +#include + +BALAU_STARTUP; + +using namespace Balau; + +void MainTask::Do() { + Printer::log(M_STATUS, "Test::Regex running"); + + Regex reg("http://([^/ ]+)/([^? ]+)(\\?([^ ]+))?"); + Regex::Captures c = reg.match("some url: http://www.test.com/uri?var1=val1 that should match"); + + Assert(c[0] == "http://www.test.com/uri?var1=val1"); + Assert(c[1] == "www.test.com"); + Assert(c[2] == "uri"); + Assert(c[3] == "?var1=val1"); + Assert(c[4] == "var1=val1"); + + Printer::log(M_STATUS, "Test::Regex passed"); +} -- cgit v1.2.3