unf 0.2.0.beta1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +42 -0
- data/CHANGELOG.md +8 -0
- data/lib/unf/normalizer_cruby.rb +9 -6
- data/lib/unf/version.rb +1 -1
- data/unf.gemspec +3 -3
- metadata +25 -19
- data/.gitignore +0 -17
- data/.travis.yml +0 -17
- data/Rakefile +0 -21
- data/test/helper.rb +0 -17
- data/test/normalization-test.txt +0 -108816
- data/test/test_unf.rb +0 -41
data/test/test_unf.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'helper'
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
class TestUNF < Test::Unit::TestCase
|
6
|
-
test "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
|
-
test "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
|