pulsar/spec/stdlib/onig-reg-exp-spec.coffee
Nathan Sobo 031da13316 Remove unused methods from native OnigRegExp
`OnigScanner` takes over these duties
2012-10-25 12:23:37 -06:00

14 lines
503 B
CoffeeScript

describe "OnigRegExp", ->
describe ".search(string, index)", ->
it "returns an array of the match and all capture groups", ->
regex = new OnigRegExp("\\w(\\d+)")
result = regex.search("----a123----")
expect(result).toEqual ["a123", "123"]
expect(result.index).toBe 4
expect(result.indices).toEqual [4, 5]
it "returns null if it does not match", ->
regex = new OnigRegExp("\\w(\\d+)")
result = regex.search("--------")
expect(result).toBeNull()