Skip to content

Commit d724bd9

Browse files
committed
Spec --enable- and --disable- flags
1 parent 9f07ab8 commit d724bd9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/ruby/command_line/feature_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,52 @@
55
it "can be used with gems" do
66
ruby_exe("p defined?(Gem)", options: "--enable=gems").chomp.should == "\"constant\""
77
ruby_exe("p defined?(Gem)", options: "--disable=gems").chomp.should == "nil"
8+
ruby_exe("p defined?(Gem)", options: "--enable-gems").chomp.should == "\"constant\""
9+
ruby_exe("p defined?(Gem)", options: "--disable-gems").chomp.should == "nil"
810
end
911

1012
it "can be used with gem" do
1113
ruby_exe("p defined?(Gem)", options: "--enable=gem").chomp.should == "\"constant\""
1214
ruby_exe("p defined?(Gem)", options: "--disable=gem").chomp.should == "nil"
15+
ruby_exe("p defined?(Gem)", options: "--enable-gem").chomp.should == "\"constant\""
16+
ruby_exe("p defined?(Gem)", options: "--disable-gem").chomp.should == "nil"
1317
end
1418

1519
it "can be used with did_you_mean" do
1620
ruby_exe("p defined?(DidYouMean)", options: "--enable=did_you_mean").chomp.should == "\"constant\""
1721
ruby_exe("p defined?(DidYouMean)", options: "--disable=did_you_mean").chomp.should == "nil"
22+
ruby_exe("p defined?(DidYouMean)", options: "--enable-did_you_mean").chomp.should == "\"constant\""
23+
ruby_exe("p defined?(DidYouMean)", options: "--disable-did_you_mean").chomp.should == "nil"
1824
end
1925

2026
it "can be used with rubyopt" do
2127
ruby_exe("p $VERBOSE", options: "--enable=rubyopt", env: {'RUBYOPT' => '-w'}).chomp.should == "true"
2228
ruby_exe("p $VERBOSE", options: "--disable=rubyopt", env: {'RUBYOPT' => '-w'}).chomp.should == "false"
29+
ruby_exe("p $VERBOSE", options: "--enable-rubyopt", env: {'RUBYOPT' => '-w'}).chomp.should == "true"
30+
ruby_exe("p $VERBOSE", options: "--disable-rubyopt", env: {'RUBYOPT' => '-w'}).chomp.should == "false"
2331
end
2432

2533
it "can be used with frozen-string-literal" do
2634
ruby_exe("p 'foo'.frozen?", options: "--enable=frozen-string-literal").chomp.should == "true"
2735
ruby_exe("p 'foo'.frozen?", options: "--disable=frozen-string-literal").chomp.should == "false"
36+
ruby_exe("p 'foo'.frozen?", options: "--enable-frozen-string-literal").chomp.should == "true"
37+
ruby_exe("p 'foo'.frozen?", options: "--disable-frozen-string-literal").chomp.should == "false"
2838
end
2939

3040
ruby_version_is "2.6" do
3141
it "can be used with jit" do
3242
ruby_exe("p RubyVM::MJIT.enabled?", options: "--enable=jit").chomp.should == "true"
3343
ruby_exe("p RubyVM::MJIT.enabled?", options: "--disable=jit").chomp.should == "false"
44+
ruby_exe("p RubyVM::MJIT.enabled?", options: "--enable-jit").chomp.should == "true"
45+
ruby_exe("p RubyVM::MJIT.enabled?", options: "--disable-jit").chomp.should == "false"
3446
end
3547
end
3648

3749
it "prints a warning for unknown features" do
3850
ruby_exe("p 14", options: "--enable=ruby-spec-feature-does-not-exist 2>&1").chomp.should include('warning: unknown argument for --enable')
3951
ruby_exe("p 14", options: "--disable=ruby-spec-feature-does-not-exist 2>&1").chomp.should include('warning: unknown argument for --disable')
52+
ruby_exe("p 14", options: "--enable-ruby-spec-feature-does-not-exist 2>&1").chomp.should include('warning: unknown argument for --enable')
53+
ruby_exe("p 14", options: "--disable-ruby-spec-feature-does-not-exist 2>&1").chomp.should include('warning: unknown argument for --disable')
4054
end
4155

4256
end

0 commit comments

Comments
 (0)