Browse files

Fixing Ruby 1.8 issue (Encoding class not available)

  • Loading branch information...
1 parent a04853a commit 77d45541d85c26ce235b6c494bd94b37b61edb5a Cameron Dutro committed Apr 27, 2012
Showing with 10 additions and 9 deletions.
  1. +10 −9 spec/normalizers/canonical/nfd_spec.rb
View
19 spec/normalizers/canonical/nfd_spec.rb
@@ -32,16 +32,17 @@
describe "#normalize_code_points" do
it "passes all the tests in NormalizersTest.txt" do
- Encoding.default_external = Encoding::UTF_8
normalization_test_file = File.join(File.dirname(File.dirname(__FILE__)), "NormalizationTest.txt")
- lines = IO.readlines(normalization_test_file).each do |line|
- unless line[0] =~ /(@|#)/ || line.empty?
- c1, c2, c3, c4, c5 = line.split(';')[0...5].map { |cps| cps.split }
- NFD.normalize_code_points(c1).should == c3
- NFD.normalize_code_points(c2).should == c3
- NFD.normalize_code_points(c3).should == c3
- NFD.normalize_code_points(c4).should == c5
- NFD.normalize_code_points(c5).should == c5
+ File.open(normalization_test_file, "r:UTF-8") do |file|
+ while line = file.gets
+ unless line =~ /(@|#)/ || line.empty?
+ c1, c2, c3, c4, c5 = line.split(';')[0...5].map { |cps| cps.split }
+ NFD.normalize_code_points(c1).should == c3
+ NFD.normalize_code_points(c2).should == c3
+ NFD.normalize_code_points(c3).should == c3
+ NFD.normalize_code_points(c4).should == c5
+ NFD.normalize_code_points(c5).should == c5
+ end
end
end
end

0 comments on commit 77d4554

Please sign in to comment.