unf 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +24 -0
- data/README.md +39 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/lib/unf.rb +27 -0
- data/lib/unf_jruby.rb +30 -0
- data/test/helper.rb +18 -0
- data/test/normalization-test.txt +108816 -0
- data/test/test_unf.rb +41 -0
- data/unf.gemspec +65 -0
- metadata +153 -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,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{unf}
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = [%q{Akinori MUSHA}]
|
12
|
+
s.date = %q{2011-10-24}
|
13
|
+
s.description = %q{This is a wrapper library to bring Unicode Normalization Form support
|
14
|
+
to Ruby/JRuby.
|
15
|
+
}
|
16
|
+
s.email = %q{knu@idaemons.org}
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/unf.rb",
|
29
|
+
"lib/unf_jruby.rb",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/normalization-test.txt",
|
32
|
+
"test/test_unf.rb",
|
33
|
+
"unf.gemspec"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/knu/unf}
|
36
|
+
s.licenses = [%q{MIT}]
|
37
|
+
s.require_paths = [%q{lib}]
|
38
|
+
s.rubygems_version = %q{1.8.5}
|
39
|
+
s.summary = %q{A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby}
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_runtime_dependency(%q<unf_ext>, [">= 0"])
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
49
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<unf_ext>, [">= 0"])
|
52
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
55
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
56
|
+
end
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<unf_ext>, [">= 0"])
|
59
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
62
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Akinori MUSHA
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-24 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: unf_ext
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: shoulda
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :development
|
46
|
+
requirement: *id002
|
47
|
+
prerelease: false
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bundler
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 23
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 0
|
59
|
+
- 0
|
60
|
+
version: 1.0.0
|
61
|
+
type: :development
|
62
|
+
requirement: *id003
|
63
|
+
prerelease: false
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: jeweler
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ~>
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 7
|
72
|
+
segments:
|
73
|
+
- 1
|
74
|
+
- 6
|
75
|
+
- 4
|
76
|
+
version: 1.6.4
|
77
|
+
type: :development
|
78
|
+
requirement: *id004
|
79
|
+
prerelease: false
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rcov
|
82
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
type: :development
|
92
|
+
requirement: *id005
|
93
|
+
prerelease: false
|
94
|
+
description: |
|
95
|
+
This is a wrapper library to bring Unicode Normalization Form support
|
96
|
+
to Ruby/JRuby.
|
97
|
+
|
98
|
+
email: knu@idaemons.org
|
99
|
+
executables: []
|
100
|
+
|
101
|
+
extensions: []
|
102
|
+
|
103
|
+
extra_rdoc_files:
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
files:
|
107
|
+
- .document
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- VERSION
|
113
|
+
- lib/unf.rb
|
114
|
+
- lib/unf_jruby.rb
|
115
|
+
- test/helper.rb
|
116
|
+
- test/normalization-test.txt
|
117
|
+
- test/test_unf.rb
|
118
|
+
- unf.gemspec
|
119
|
+
homepage: http://github.com/knu/unf
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
requirements: []
|
146
|
+
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 1.8.5
|
149
|
+
signing_key:
|
150
|
+
specification_version: 3
|
151
|
+
summary: A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby
|
152
|
+
test_files: []
|
153
|
+
|