aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-util.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-util.js')
-rw-r--r--tests/test-util.js38
1 files changed, 30 insertions, 8 deletions
diff --git a/tests/test-util.js b/tests/test-util.js
index 0621ad9..a9d0e6a 100644
--- a/tests/test-util.js
+++ b/tests/test-util.js
@@ -73,6 +73,27 @@ exports.ensureIsInListNoMember = function (test) {
"conversion of a string to an array");
};
+// testing util.filterByRegexp
+exports.ensureFilterByRegexp = function (test) {
+ var list = [
+ {
+ "regexp": "test(ing|ed)",
+ "addr": "correct"
+ },
+ {
+ "regexp": "ba.*d",
+ "addr": true
+ }
+ ];
+
+ test.assertEqual(util.filterByRegexp(list,"testing"),"correct",
+ "simple testing of filterByRegexp");
+ test.assertEqual(util.filterByRegexp(list,"unknown value"),"",
+ "simple testing of filterByRegexp with non-found address");
+ test.assert(util.filterByRegexp(list,"baaad"),
+ "simple testing of filterByRegexp with non-string return value");
+};
+
// testing util.getISODate
exports.ensureGetISODate = function (test) {
test.assertEqual(util.getISODate("Mon May 31 2010 23:29:09 GMT+0200 (CET)"),
@@ -160,14 +181,15 @@ exports.ensureLoadText = function (test) {
});
};
-//exports.ensureLoadTextUnicode = function (test) {
-// var url = "http://matej.ceplovi.cz/progs/data/pushkin.txt", text = "";
-// test.waitUntilDone();
-// util.loadText(url, function (txt) {
-// test.assertEqual(txt, pushkinTestString);
-// test.done();
-// });
-//};
+// exports.ensureLoadTextUnicode = function (test) {
+// var url = "http://matej.ceplovi.cz/progs/data/pushkin.txt", text = "";
+// test.waitUntilDone();
+// util.loadText(url, function (txt) {
+// console.log(txt);
+// //test.assertEqual(txt, pushkinTestString);
+// test.done();
+// });
+// };
//// testing util.loadJSON
exports.ensureLoadJSON = function (test) {