diff options
author | shmuz <shmuz> | 2008-03-30 10:03:15 +0000 |
---|---|---|
committer | shmuz <shmuz> | 2008-03-30 10:03:15 +0000 |
commit | 39aa00f6fc5bc386100f07f5788851312553e392 (patch) | |
tree | 680e776649a3c9dc0f87d80b02f88188a88a62c1 /test | |
parent | fe95d1a154333fdb09f33e7d06ca302e9e0f8629 (diff) | |
download | lrexlib-39aa00f6fc5bc386100f07f5788851312553e392.tar.gz |
Add tests for new methods (match and find).
Diffstat (limited to 'test')
-rwxr-xr-x | test/common_sets.lua | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/common_sets.lua b/test/common_sets.lua index 38a3eb5..6b7dd18 100755 --- a/test/common_sets.lua +++ b/test/common_sets.lua @@ -119,7 +119,35 @@ local function set_m_tfind (lib, flg) { {".+"}, {"abcd",-2}, {3,4,{}} }, -- negative st { {".*"}, {"abcd"}, {1,4,{}} }, -- [none] { {"bc"}, {"abc"}, {2,3,{}} }, -- [none] - { { "(.)b.(d)"}, {"abcd"}, {1,4,{"a","d"}}},--[captures] + { {"(.)b.(d)"}, {"abcd"}, {1,4,{"a","d"}}},--[captures] + } +end + +local function set_m_find (lib, flg) + return { + Name = "Method find", + Method = "find", + --{patt}, {subj, st} { results } + { {".+"}, {"abcd"}, {1,4} }, -- [none] + { {".+"}, {"abcd",2}, {2,4} }, -- positive st + { {".+"}, {"abcd",-2}, {3,4} }, -- negative st + { {".*"}, {"abcd"}, {1,4} }, -- [none] + { {"bc"}, {"abc"}, {2,3} }, -- [none] + { {"(.)b.(d)"}, {"abcd"}, {1,4,"a","d"}},--[captures] + } +end + +local function set_m_match (lib, flg) + return { + Name = "Method match", + Method = "match", + --{patt}, {subj, st} { results } + { {".+"}, {"abcd"}, {"abcd"} }, -- [none] + { {".+"}, {"abcd",2}, {"bcd" } }, -- positive st + { {".+"}, {"abcd",-2}, {"cd" } }, -- negative st + { {".*"}, {"abcd"}, {"abcd"} }, -- [none] + { {"bc"}, {"abc"}, {"bc" } }, -- [none] + {{ "(.)b.(d)"}, {"abcd"}, {"a","d"} }, --[captures] } end @@ -294,6 +322,8 @@ return function (libname) set_f_match (lib), set_m_exec (lib), set_m_tfind (lib), + set_m_find (lib), + set_m_match (lib), set_f_gsub1 (lib), set_f_gsub2 (lib), set_f_gsub3 (lib), |