File: unicode_spec.rb

package info (click to toggle)
ruby-twitter-text 1.14.7%2Bconformance-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 796 kB
  • sloc: ruby: 2,917; java: 1,571; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (5)
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
31
# encoding: utf-8
require File.dirname(__FILE__) + '/spec_helper'

describe Twitter::Unicode do

  it "should lazy-init constants" do
    Twitter::Unicode.const_defined?(:UFEB6).should == false
    Twitter::Unicode::UFEB6.should_not be_nil
    Twitter::Unicode::UFEB6.should be_kind_of(String)
    Twitter::Unicode.const_defined?(:UFEB6).should == true
  end

  it "should return corresponding character" do
    Twitter::Unicode::UFEB6.should == [0xfeb6].pack('U')
  end

  it "should allow lowercase notation" do
    Twitter::Unicode::Ufeb6.should == Twitter::Unicode::UFEB6
    Twitter::Unicode::Ufeb6.should === Twitter::Unicode::UFEB6
  end

  it "should allow underscore notation" do
    Twitter::Unicode::U_FEB6.should == Twitter::Unicode::UFEB6
    Twitter::Unicode::U_FEB6.should === Twitter::Unicode::UFEB6
  end

  it "should raise on invalid codepoints" do
    lambda { Twitter::Unicode::FFFFFF }.should raise_error(NameError)
  end

end