unf 0.0.5-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +24 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/lib/unf.rb +26 -0
- data/lib/unf/normalizer.rb +17 -0
- data/lib/unf/normalizer_cruby.rb +1 -0
- data/lib/unf/normalizer_jruby.rb +30 -0
- data/lib/unf/version.rb +3 -0
- data/test/helper.rb +18 -0
- data/test/normalization-test.txt +108816 -0
- data/test/test_unf.rb +41 -0
- data/unf.gemspec +28 -0
- metadata +116 -0
data/test/test_unf.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
class TestUNF < Test::Unit::TestCase
|
6
|
+
should "raise ArgumentError if an unknown normalization form is given" do
|
7
|
+
normalizer = UNF::Normalizer.new
|
8
|
+
assert_raises(ArgumentError) { normalizer.normalize("が", :nfck) }
|
9
|
+
end
|
10
|
+
|
11
|
+
should "pass all tests bundled with the original unf" do
|
12
|
+
normalizer = UNF::Normalizer.new
|
13
|
+
open(Pathname(__FILE__).dirname + 'normalization-test.txt', 'r:utf-8').each_slice(6) { |lines|
|
14
|
+
flunk "broken test file" if lines.size != 6 || lines.pop !~ /^$/
|
15
|
+
str, nfd, nfc, nfkd, nfkc = lines
|
16
|
+
assert nfd, normalizer.normalize(str, :nfd)
|
17
|
+
assert nfd, normalizer.normalize(nfd, :nfd)
|
18
|
+
assert nfd, normalizer.normalize(nfc, :nfd)
|
19
|
+
assert nfkd, normalizer.normalize(nfkc, :nfd)
|
20
|
+
assert nfkd, normalizer.normalize(nfkc, :nfd)
|
21
|
+
|
22
|
+
assert nfc, normalizer.normalize(str, :nfd)
|
23
|
+
assert nfc, normalizer.normalize(nfd, :nfc)
|
24
|
+
assert nfc, normalizer.normalize(nfc, :nfc)
|
25
|
+
assert nfkc, normalizer.normalize(nfkc, :nfc)
|
26
|
+
assert nfkc, normalizer.normalize(nfkd, :nfc)
|
27
|
+
|
28
|
+
assert nfkd, normalizer.normalize(str, :nfkd)
|
29
|
+
assert nfkd, normalizer.normalize(nfd, :nfkd)
|
30
|
+
assert nfkd, normalizer.normalize(nfc, :nfkd)
|
31
|
+
assert nfkd, normalizer.normalize(nfkc, :nfkd)
|
32
|
+
assert nfkd, normalizer.normalize(nfkd, :nfkd)
|
33
|
+
|
34
|
+
assert nfkc, normalizer.normalize(str, :nfkc)
|
35
|
+
assert nfkc, normalizer.normalize(nfd, :nfkc)
|
36
|
+
assert nfkc, normalizer.normalize(nfc, :nfkc)
|
37
|
+
assert nfkc, normalizer.normalize(nfkc, :nfkc)
|
38
|
+
assert nfkc, normalizer.normalize(nfkd, :nfkc)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
data/unf.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/unf/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Akinori MUSHA"]
|
6
|
+
gem.email = ["knu@idaemons.org"]
|
7
|
+
gem.description = <<-'EOS'
|
8
|
+
This is a wrapper library to bring Unicode Normalization Form support
|
9
|
+
to Ruby/JRuby.
|
10
|
+
EOS
|
11
|
+
gem.summary = %q{A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby}
|
12
|
+
gem.homepage = "https://github.com/knu/ruby-unf"
|
13
|
+
gem.platform = defined?(JRUBY_VERSION) ? 'jruby' : Gem::Platform::RUBY
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.name = "unf"
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.version = UNF::VERSION
|
21
|
+
|
22
|
+
gem.add_dependency 'unf_ext', '>= 0' unless defined?(JRUBY_VERSION)
|
23
|
+
|
24
|
+
gem.add_development_dependency 'shoulda', '>= 0'
|
25
|
+
gem.add_development_dependency 'bundler', '~> 1.0.0'
|
26
|
+
gem.add_development_dependency 'jeweler', '~> 1.6.4'
|
27
|
+
gem.add_development_dependency 'rcov', '>= 0'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.5
|
6
|
+
platform: jruby
|
7
|
+
authors:
|
8
|
+
- Akinori MUSHA
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-03-04 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.0.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jeweler
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.4
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rcov
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
description: |
|
60
|
+
This is a wrapper library to bring Unicode Normalization Form support
|
61
|
+
to Ruby/JRuby.
|
62
|
+
|
63
|
+
email:
|
64
|
+
- knu@idaemons.org
|
65
|
+
executables: []
|
66
|
+
|
67
|
+
extensions: []
|
68
|
+
|
69
|
+
extra_rdoc_files: []
|
70
|
+
|
71
|
+
files:
|
72
|
+
- .gitignore
|
73
|
+
- Gemfile
|
74
|
+
- LICENSE
|
75
|
+
- README.md
|
76
|
+
- Rakefile
|
77
|
+
- lib/unf.rb
|
78
|
+
- lib/unf/normalizer.rb
|
79
|
+
- lib/unf/normalizer_cruby.rb
|
80
|
+
- lib/unf/normalizer_jruby.rb
|
81
|
+
- lib/unf/version.rb
|
82
|
+
- test/helper.rb
|
83
|
+
- test/normalization-test.txt
|
84
|
+
- test/test_unf.rb
|
85
|
+
- unf.gemspec
|
86
|
+
homepage: https://github.com/knu/ruby-unf
|
87
|
+
licenses: []
|
88
|
+
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: "0"
|
106
|
+
requirements: []
|
107
|
+
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 1.8.17
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby
|
113
|
+
test_files:
|
114
|
+
- test/helper.rb
|
115
|
+
- test/normalization-test.txt
|
116
|
+
- test/test_unf.rb
|