Sha256: bd5acb423d27f0336de9c686bbb02cbf1676dd5c2546b4e59bc44f61ec59716e

Contents?: true

Size: 865 Bytes

Versions: 5

Compression:

Stored size: 865 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

describe ICU::CharDet::Detector do

  before { @d = ICU::CharDet::Detector.new }
  after { @d.close }

  it "should recognize UTF-8" do
    m = @d.detect("æåø")
    m.name.should == "UTF-8"
    m.language.should be_kind_of(String)
  end

  it "has a list of detectable charsets" do
    cs = @d.detectable_charsets
    cs.should be_kind_of(Array)
    cs.should_not be_empty

    cs.first.should be_kind_of(String)
  end

  it "should disable / enable the input filter" do
    @d.input_filter_enabled?.should be_false
    @d.input_filter_enabled = true
    @d.input_filter_enabled?.should be_true
  end

  it "should should set declared encoding" do
    @d.declared_encoding = "UTF-8"
  end

  it "should detect several matching encodings" do
    r = @d.detect_all("foo bar")
    r.should be_instance_of(Array)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffi-icu-0.0.5 spec/chardet_spec.rb
ffi-icu-0.0.4 spec/chardet_spec.rb
ffi-icu-0.0.3 spec/chardet_spec.rb
ffi-icu-0.0.2 spec/chardet_spec.rb
ffi-icu-0.0.1 spec/chardet_spec.rb