Sha256: 19f0b8d2158b61e0d221f5c5a2b7d650d2656b3f38440fa2416d51686845062c
Contents?: true
Size: 802 Bytes
Versions: 36
Compression:
Stored size: 802 Bytes
Contents
require 'spec_helper' RSpec.describe('passing options to parse') do it 'raises if if parsing from a Regexp and options are passed' do expect { RP.parse(/a+/, options: ::Regexp::EXTENDED) }.to raise_error( ArgumentError, 'options cannot be supplied unless parsing a String' ) end it 'sets options if parsing from a String' do root = RP.parse('a+', options: ::Regexp::MULTILINE | ::Regexp::EXTENDED) expect(root.options).to eq(m: true, x: true) end it 'allows options to not be supplied when parsing from a Regexp' do root = RP.parse(/a+/ix) expect(root.options).to eq(i: true, x: true) end it 'has an empty option-hash when parsing from a String and passing no options' do root = RP.parse('a+') expect(root.options).to be_empty end end
Version data entries
36 entries across 26 versions & 7 rubygems