File: test_spec.rb

package info (click to toggle)
ruby-uc.micro-rb 1.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 112 kB
  • sloc: ruby: 76; makefile: 7
file content (30 lines) | stat: -rwxr-xr-x 979 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
28
29
30
require 'spec_helper'

describe 'Unicode classes' do
  it 'Any' do
    expect(UCMicro::Properties::Any::REGEX.match('A')).not_to eq nil
    expect(UCMicro::Properties::Any::REGEX.match('')).to eq nil
  end

  it 'Cc' do
    expect(UCMicro::Categories::Cc::REGEX.match("\r")).not_to eq nil
    expect(UCMicro::Categories::Cc::REGEX.match('A')).to eq nil
  end

  it 'Cf' do
    expect(UCMicro::Categories::Cf::REGEX.match(0xAD.chr(Encoding::UTF_8))).not_to eq nil
    expect(UCMicro::Categories::Cf::REGEX.match('A')).to eq nil
  end

  it 'P' do
    expect(UCMicro::Categories::P::REGEX.match(',')).not_to eq nil
    expect(UCMicro::Categories::P::REGEX.match('A')).to eq nil
  end

  it 'Z' do
    expect(UCMicro::Categories::Z::REGEX.match(' ')).not_to eq nil
    expect(UCMicro::Categories::Z::REGEX.match("\u2028")).not_to eq nil
    expect(UCMicro::Categories::Z::REGEX.match("\u2029")).not_to eq nil
    expect(UCMicro::Categories::Z::REGEX.match('A')).to eq nil
  end
end