(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func Test_func_matches(t *testing.T) { |
| 170 | test_xpath_eval(t, empty_example, `matches("abracadabra", "bra")`, true) |
| 171 | test_xpath_eval(t, empty_example, `matches("abracadabra", "(?i)^A.*A$")`, true) |
| 172 | test_xpath_eval(t, empty_example, `matches("abracadabra", "^a.*a$")`, true) |
| 173 | test_xpath_eval(t, empty_example, `matches("abracadabra", "^bra")`, false) |
| 174 | assertPanic(t, func() { selectNode(html_example, `//*[matches()]`) }) // arg len check failure |
| 175 | assertPanic(t, func() { selectNode(html_example, "//*[matches(substring(), 0)]") }) // first arg processing failure |
| 176 | assertPanic(t, func() { selectNode(html_example, "//*[matches(@href, substring())]") }) // second arg processing failure |
| 177 | assertPanic(t, func() { selectNode(html_example, "//*[matches(@href, 0)]") }) // second arg not string |
| 178 | assertPanic(t, func() { selectNode(html_example, "//*[matches(@href, '[invalid')]") }) // second arg invalid regexp |
| 179 | // testing unexpected the regular expression. |
| 180 | _, err := Compile(`//*[matches(., '^[\u0621-\u064AA-Za-z\-]+')]`) |
| 181 | assertErr(t, err) |
| 182 | _, err = Compile(`//*[matches(., '//*[matches(., '\w+`) |
| 183 | assertErr(t, err) |
| 184 | } |
| 185 | |
| 186 | func Test_func_number(t *testing.T) { |
| 187 | test_xpath_eval(t, empty_example, `number(10)`, float64(10)) |
nothing calls this directly
no test coverage detected
searching dependent graphs…