File: free_space_spec.rb

package info (click to toggle)
ruby-regexp-parser 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 968 kB
  • sloc: ruby: 6,396; sh: 12; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 648 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

RSpec.describe(Regexp::Expression::FreeSpace) do
  specify('white space quantify raises error') do
    regexp = /
      a # Comment
    /x

    root = RP.parse(regexp)
    space = root[0]

    expect(space).to be_instance_of(FreeSpace::WhiteSpace)
    expect { space.quantify(:dummy, '#') }.to raise_error(Regexp::Parser::Error)
  end

  specify('comment quantify raises error') do
    regexp = /
      a # Comment
    /x

    root = RP.parse(regexp)
    comment = root[3]

    expect(comment).to be_instance_of(FreeSpace::Comment)
    expect { comment.quantify(:dummy, '#') }.to raise_error(Regexp::Parser::Error)
  end
end