summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-05-01 14:09:24 -0400
committerKevin Newton <kddnewton@gmail.com>2024-05-01 14:49:45 -0400
commitfebad5cbda83da6cadd682b52ca533751ff523db (patch)
tree1460c48ead63ccffa4769ee4f90cf2d1150d5fc1 /spec
parent41f8ae1ffdca349d0301b480c690e83a1dd1e723 (diff)
Skip Warning.[] spec if mspec is passing warning options
Diffstat (limited to 'spec')
-rw-r--r--spec/prism.mspec4
-rw-r--r--spec/ruby/core/warning/element_reference_spec.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/prism.mspec b/spec/prism.mspec
index 1671cd3c74..70ca3ac8f8 100644
--- a/spec/prism.mspec
+++ b/spec/prism.mspec
@@ -1,9 +1,5 @@
# frozen_string_literal: true
-# This is turned off because when we run with --parser=prism we explicitly turn
-# off experimental warnings to make sure the output is consistent.
-MSpec.register(:exclude, "Warning.[] returns default values for categories :deprecated and :experimental")
-
## Language
MSpec.register(:exclude, "Hash literal raises a SyntaxError at parse time when Symbol key with invalid bytes")
MSpec.register(:exclude, "Hash literal raises a SyntaxError at parse time when Symbol key with invalid bytes and 'key: value' syntax used")
diff --git a/spec/ruby/core/warning/element_reference_spec.rb b/spec/ruby/core/warning/element_reference_spec.rb
index 8cb4018c20..c0ed37ef13 100644
--- a/spec/ruby/core/warning/element_reference_spec.rb
+++ b/spec/ruby/core/warning/element_reference_spec.rb
@@ -2,6 +2,10 @@ require_relative '../../spec_helper'
describe "Warning.[]" do
it "returns default values for categories :deprecated and :experimental" do
+ # If any warning options were set on the Ruby that will be executed, then
+ # it's possible this test will fail. In this case we will skip this test.
+ skip if ruby_exe.any? { |opt| opt.start_with?("-W") }
+
ruby_exe('p [Warning[:deprecated], Warning[:experimental]]').chomp.should == "[false, true]"
ruby_exe('p [Warning[:deprecated], Warning[:experimental]]', options: "-w").chomp.should == "[true, true]"
end