Permalink
Browse files

Merge pull request #83 from KL-7/rcov-fix

Fix rcov rake task, add rcov:full. Mark Bidi specs as slow.
  • Loading branch information...
camertron committed Nov 14, 2012
2 parents 5a0749e + 9e35fc6 commit 22a1910e4b7d822a1ce5d6c30cc1eb35a6d55eda
Showing with 60 additions and 22 deletions.
  1. +5 −0 Gemfile
  2. +26 −5 Rakefile
  3. +1 −1 spec/bidi/bidi_spec.rb
  4. +7 −0 spec/spec_helper.rb
  5. +21 −16 spec/utils/yaml/yaml_spec.rb
View
@@ -21,5 +21,10 @@ group :test do
platform :mri_18 do
gem 'rcov'
end
+
+ platform :mri_19 do
+ gem 'simplecov'
+ gem 'launchy'
+ end
end
View
@@ -32,11 +32,32 @@ namespace :spec do
end
if RUBY_VERSION < '1.9.0'
- desc 'Run all examples with RCov'
- RSpec::Core::RakeTask.new('spec:rcov') do |t|
- t.rcov = true
- t.pattern = './spec/**/*_spec.rb'
- t.rcov_opts = %w(-T --sort coverage --exclude gems/,spec/)
+ desc 'Run specs with RCov'
+ RSpec::Core::RakeTask.new('spec:cov') do |t|
+ t.rcov = true
+ t.pattern = './spec/**/*_spec.rb'
+ t.rcov_opts = '-T --sort coverage --exclude gems/,spec/'
+ end
+
+ desc 'Run full specs suit with RCov'
+ task 'spec:cov:full' => %w[spec:full_spec_env spec:cov]
+else
+ namespace :spec do
+ desc 'Run specs with SimpleCov'
+ task :cov => ['spec:simplecov_env', :spec] do
+ require 'launchy'
+ Launchy.open 'coverage/index.html'
+ end
+
+ desc 'Run full specs suit with SimpleCov'
+ task 'cov:full' => %w[spec:full_spec_env spec:cov]
+
+ task :simplecov_env do
+ puts 'Cleaning up coverage reports'
+ rm_rf 'coverage'
+
+ ENV['SCOV'] = 'true'
+ end
end
end
View
@@ -20,7 +20,7 @@ def expand_bitset_str(bitset)
end
describe Bidi do
- it "should pass the derived tests in classpath_bidi_test.txt" do
+ it "should pass the derived tests in classpath_bidi_test.txt", :slow => true do
expected_level_data = []
expected_reorder_data = []
num_failed = 0
View
@@ -4,8 +4,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
require 'rspec'
+require 'rspec/autorun' # somehow makes rcov work with rspec
require 'twitter_cldr'
+if ENV['SCOV']
+ require 'simplecov'
+ SimpleCov.start
+ puts 'Running simplecov'
+end
+
class FastGettext
class << self
@@locale = :en
@@ -7,30 +7,35 @@
# https://github.com/afunai/ya2yaml
# Copyright (c) 2006 Akira FUNAI <funai.akira@gmail.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
+#
+# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
require 'spec_helper'
require 'yaml'
# Psych doesn't handle Unicode characters properly, have to use Syck instead.
-YAML::ENGINE.yamler = 'syck' if YAML.const_defined?(:ENGINE)
+if YAML.const_defined?(:ENGINE)
+ # Fix undefined method `syck_to_yaml' for class `Object' error on MRI 1.9.3.
+ # Target only MRI >= 1.9, because on other Rubies, e.g., JRuby, requiring 'syck' results in a LoadError.
+ require 'syck' if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
+ YAML::ENGINE.yamler = 'syck'
+end
# There's an incompatibility in how ruby handles struct dumps
# between versions that's beyond our scope.

0 comments on commit 22a1910

Please sign in to comment.