diff --git a/Gemfile b/Gemfile index 7e5afeb..d3fdb90 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,4 @@ gem "rspec" gem "rdoc" gem "redcarpet" gem "syntax" +gem "simplecov" diff --git a/Gemfile.lock b/Gemfile.lock index 7cca6be..535c103 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ GEM remote: https://rubygems.org/ specs: diff-lcs (1.5.0) + docile (1.4.0) psych (5.1.0) stringio rake (13.0.6) @@ -21,6 +22,12 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) stringio (3.0.7) syntax (1.2.2) @@ -32,6 +39,7 @@ DEPENDENCIES rdoc redcarpet rspec + simplecov syntax BUNDLED WITH diff --git a/Rakefile b/Rakefile index aa97e1d..c7a43af 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,8 @@ +require "rake/clean" require "rspec/core/rake_task" +CLEAN.include %w[spec/run gen .yardoc yard coverage dist] + task :build_dist do sh "ruby rb/build_dist.rb" end diff --git a/spec/propane_spec.rb b/spec/propane_spec.rb index 5467f9a..06ca243 100644 --- a/spec/propane_spec.rb +++ b/spec/propane_spec.rb @@ -4,19 +4,52 @@ require "open3" Results = Struct.new(:stdout, :stderr, :status) describe Propane do + before(:all) do + @statics = {} + end + def write_grammar(grammar, options = {}) options[:name] ||= "" File.write("spec/run/testparser#{options[:name]}.propane", grammar) end def build_parser(options = {}) - options[:name] ||= "" + @statics[:build_test_id] ||= 0 + @statics[:build_test_id] += 1 if ENV["dist_specs"] - propane = "dspec/propane" + command = %W[dist/propane] else - propane = "./propane.sh" + command = %W[ruby -I spec/run -r _simplecov_setup -I lib bin/propane] + command_prefix = + if ENV["partial_specs"] + "p" + else + "b" + end + command_name = "#{command_prefix}#{@statics[:build_test_id]}" + File.open("spec/run/_simplecov_setup.rb", "w") do |fh| + fh.puts <