diff options
| author | Sergio Queiroz <sqmedeiros@gmail.com> | 2016-07-01 15:16:49 -0300 |
|---|---|---|
| committer | Sergio Queiroz <sqmedeiros@gmail.com> | 2016-07-01 15:16:49 -0300 |
| commit | 2937e9cf882d61eb64fccd15ddaf1465643ac201 (patch) | |
| tree | adb45665f423c185a4cc8f8747fd178e78a699f6 | |
| parent | 7cd05bfaeea0fc1d269ace114d3225bffbd82940 (diff) | |
| download | lpeglabel-2937e9cf882d61eb64fccd15ddaf1465643ac201.tar.gz lpeglabel-2937e9cf882d61eb64fccd15ddaf1465643ac201.tar.bz2 lpeglabel-2937e9cf882d61eb64fccd15ddaf1465643ac201.zip | |
Adding tests to check the limit of labels
| -rw-r--r-- | testlabel.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testlabel.lua b/testlabel.lua index f7180a7..4f0768d 100644 --- a/testlabel.lua +++ b/testlabel.lua | |||
| @@ -180,6 +180,24 @@ assert(p:match("abc") == 2) | |||
| 180 | r, l, serror = p:match("") | 180 | r, l, serror = p:match("") |
| 181 | assert(r == nil and l == 0 and serror == "") | 181 | assert(r == nil and l == 0 and serror == "") |
| 182 | 182 | ||
| 183 | -- testing the limit of labels | ||
| 184 | p = m.T(0) | ||
| 185 | s = "abc" | ||
| 186 | r, l, serror = p:match(s) | ||
| 187 | assert(r == nil and l == 0 and serror == "abc") | ||
| 188 | |||
| 189 | p = m.T(255) | ||
| 190 | s = "abc" | ||
| 191 | r, l, serror = p:match(s) | ||
| 192 | assert(r == nil and l == 255 and serror == "abc") | ||
| 193 | |||
| 194 | local r = pcall(m.T, -1) | ||
| 195 | assert(r == false) | ||
| 196 | |||
| 197 | local r = pcall(m.T, 256) | ||
| 198 | assert(r == false) | ||
| 199 | |||
| 200 | |||
| 183 | print("+") | 201 | print("+") |
| 184 | 202 | ||
| 185 | --[[ grammar based on Figure 8 of paper submitted to SCP | 203 | --[[ grammar based on Figure 8 of paper submitted to SCP |
