unf 0.1.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile +4 -0
- data/LICENSE +24 -0
- data/README.md +39 -0
- data/Rakefile +21 -0
- data/lib/unf.rb +38 -0
- data/lib/unf/normalizer.rb +35 -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 +35 -0
- metadata +122 -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.instance
|
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.instance
|
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,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/unf/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "unf"
|
6
|
+
gem.version = UNF::VERSION
|
7
|
+
gem.authors = ["Akinori MUSHA"]
|
8
|
+
gem.email = ["knu@idaemons.org"]
|
9
|
+
gem.description = <<-'EOS'
|
10
|
+
This is a wrapper library to bring Unicode Normalization Form support
|
11
|
+
to Ruby/JRuby.
|
12
|
+
EOS
|
13
|
+
gem.summary = %q{A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby}
|
14
|
+
gem.homepage = "https://github.com/knu/ruby-unf"
|
15
|
+
gem.platform = defined?(JRUBY_VERSION) ? 'java' : Gem::Platform::RUBY
|
16
|
+
gem.license = "2-clause BSDL"
|
17
|
+
|
18
|
+
gem.files = `git ls-files`.split("\n")
|
19
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/.*\.rb})
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
gem.extra_rdoc_files = ['README.md', 'LICENSE']
|
23
|
+
|
24
|
+
gem.add_dependency 'unf_ext', '>= 0' unless defined?(JRUBY_VERSION)
|
25
|
+
|
26
|
+
gem.add_development_dependency 'shoulda', [RUBY_VERSION < '1.9' ? '< 3.5.0' : '>= 0']
|
27
|
+
if RUBY_VERSION < '1.9'
|
28
|
+
# Cap dependency on activesupport with < 4.0 on behalf of
|
29
|
+
# shoulda-matchers to satisfy bundler.
|
30
|
+
gem.add_development_dependency 'activesupport', ['< 4.0']
|
31
|
+
end
|
32
|
+
gem.add_development_dependency 'bundler', '>= 1.2.0'
|
33
|
+
gem.add_development_dependency 'rake', '>= 0.9.2.2'
|
34
|
+
gem.add_development_dependency 'rdoc', '> 2.4.2'
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- Akinori MUSHA
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: shoulda
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
prerelease: false
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 1.2.0
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.2.2
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.9.2.2
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>'
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.2
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>'
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.4.2
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
description: |
|
70
|
+
This is a wrapper library to bring Unicode Normalization Form support
|
71
|
+
to Ruby/JRuby.
|
72
|
+
email:
|
73
|
+
- knu@idaemons.org
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files:
|
77
|
+
- README.md
|
78
|
+
- LICENSE
|
79
|
+
files:
|
80
|
+
- .gitignore
|
81
|
+
- .travis.yml
|
82
|
+
- CHANGELOG.md
|
83
|
+
- Gemfile
|
84
|
+
- LICENSE
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- lib/unf.rb
|
88
|
+
- lib/unf/normalizer.rb
|
89
|
+
- lib/unf/normalizer_cruby.rb
|
90
|
+
- lib/unf/normalizer_jruby.rb
|
91
|
+
- lib/unf/version.rb
|
92
|
+
- test/helper.rb
|
93
|
+
- test/normalization-test.txt
|
94
|
+
- test/test_unf.rb
|
95
|
+
- unf.gemspec
|
96
|
+
homepage: https://github.com/knu/ruby-unf
|
97
|
+
licenses:
|
98
|
+
- 2-clause BSDL
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.1.9
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: A wrapper library to bring Unicode Normalization Form support to Ruby/JRuby
|
120
|
+
test_files:
|
121
|
+
- test/helper.rb
|
122
|
+
- test/test_unf.rb
|