From 2b95e7ae6cb53f987931de8f567870b9e69cdf9a Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sat, 5 Jun 2010 01:13:12 +0200 Subject: Unfinished mess of everything, unworking. --- tests/test-util.js | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'tests/test-util.js') 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) { -- cgit