summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStephen George <sfgeorge@users.noreply.github.com>2019-10-20 16:42:36 -0500
committerSutou Kouhei <kou@clear-code.com>2019-10-21 06:42:36 +0900
commit2b8ada9f162a3ee0af253390b06bbf1bc2e8014a (patch)
treeb3944de14e8891ead1dc0676d6f51b6f0eb27648 /spec
parent37483c61ba627f105ca6dcc7331641ede72da73d (diff)
downloadrake-compiler-2b8ada9f162a3ee0af253390b06bbf1bc2e8014a.tar.gz
Make lint options customizable (#158)
* Make customizable compiler Xlint option for JRuby native extension * [CS] restructure and fix indentation of (defaults) spec * Add specs for lint_option * [DOC] CHANGELOG: stub changelog entry for the next release * [DOC] CHANGELOG: Make customizable compiler Xlint option for JRuby native extension * Use "-Xlint" option for JRuby native extension by default. `javac -help -X` > -Xlint Enable recommended warnings
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/rake/javaextensiontask_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/rake/javaextensiontask_spec.rb b/spec/lib/rake/javaextensiontask_spec.rb
index 06ba2f5..353c40f 100644
--- a/spec/lib/rake/javaextensiontask_spec.rb
+++ b/spec/lib/rake/javaextensiontask_spec.rb
@@ -76,9 +76,14 @@ describe Rake::JavaExtensionTask do
@ext.config_options.should be_empty
end
+ it 'should have no lint option preset to delegate' do
+ @ext.lint_option.should be_falsey
+ end
+
it 'should default to Java platform' do
@ext.platform.should == 'java'
end
+ end
context '(tasks)' do
before :each do
@@ -165,6 +170,31 @@ describe Rake::JavaExtensionTask do
end
end
end
+
+ context 'A custom extension' do
+ let(:extension) do
+ Rake::JavaExtensionTask.new('extension_two') do |ext|
+ ext.lint_option = lint_option if lint_option
+ end
+ end
+
+ context 'without a specified lint option' do
+ let(:lint_option) { nil }
+
+ it 'should honor the lint option' do
+ (extension.lint_option).should be_falsey
+ (extension.send :java_lint_arg, extension.lint_option).should eq '-Xlint'
+ end
+ end
+
+ context "with a specified lint option of 'deprecated'" do
+ let(:lint_option) { 'deprecated'.freeze }
+
+ it 'should honor the lint option' do
+ (extension.lint_option).should eq lint_option
+ (extension.send :java_lint_arg, extension.lint_option).should eq '-Xlint:deprecated'
+ end
+ end
end
end
private