Skip Warning.[] spec if mspec is passing warning options

This commit is contained in:
Kevin Newton 2024-05-01 14:09:24 -04:00
parent 41f8ae1ffd
commit febad5cbda
2 changed files with 4 additions and 4 deletions

View File

@ -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")

View File

@ -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