diff options
author | Pixel <pixel@nobis-crew.org> | 2011-11-16 20:54:36 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-11-16 20:56:15 -0800 |
commit | 0c4f27688622053a35d5b14ad138a6cd0fba20c4 (patch) | |
tree | be626a776ad031b880dc751de129b712e234ff1c /tests | |
parent | 8ed05c55f14823b4f8782d3f096803c1d3f27d3a (diff) |
Adding the Regex class.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-Regex.cc | 21 |
1 files changed, 21 insertions, 0 deletions
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 <Main.h> +#include <BRegex.h> + +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"); +} |