File: types_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 (18 lines) | stat: -rw-r--r-- 925 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'spec_helper'

RSpec.describe('CharacterType parsing') do
  include_examples 'parse', /a\dc/, 1 => [:type, :digit,     CharacterType::Digit]
  include_examples 'parse', /a\Dc/, 1 => [:type, :nondigit,  CharacterType::NonDigit]

  include_examples 'parse', /a\sc/, 1 => [:type, :space,     CharacterType::Space]
  include_examples 'parse', /a\Sc/, 1 => [:type, :nonspace,  CharacterType::NonSpace]

  include_examples 'parse', /a\hc/, 1 => [:type, :hex,       CharacterType::Hex]
  include_examples 'parse', /a\Hc/, 1 => [:type, :nonhex,    CharacterType::NonHex]

  include_examples 'parse', /a\wc/, 1 => [:type, :word,      CharacterType::Word]
  include_examples 'parse', /a\Wc/, 1 => [:type, :nonword,   CharacterType::NonWord]

  include_examples 'parse', 'a\Rc', 1 => [:type, :linebreak, CharacterType::Linebreak]
  include_examples 'parse', 'a\Xc', 1 => [:type, :xgrapheme, CharacterType::ExtendedGrapheme]
end