[PRISM] Enable specs in CI

This commit is contained in:
Kevin Newton 2024-03-18 12:09:09 -04:00
parent 4238615432
commit 0e8b6c62a4
5 changed files with 85 additions and 10 deletions

View File

@ -95,13 +95,13 @@ jobs:
RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="test_ast.rb" --exclude="test_regexp.rb" --exclude="error_highlight/test_error_highlight.rb" --exclude="prism/encoding_test.rb"'
RUN_OPTS: ${{ matrix.run_opts }}
# - name: make test-spec
# run: |
# $SETARCH make -s test-spec RUN_OPTS="$RUN_OPTS"
# timeout-minutes: 10
# env:
# GNUMAKEFLAGS: ''
# RUN_OPTS: ${{ matrix.run_opts }}
- name: make test-prism-spec
run: |
$SETARCH make -s test-prism-spec SPECOPTS="$SPECOPTS"
timeout-minutes: 10
env:
GNUMAKEFLAGS: ''
SPECOPTS: "-T -W:no-experimental -T --parser=prism"
- uses: ./.github/actions/slack
with:

View File

@ -1007,6 +1007,15 @@ yes-test-spec: yes-test-spec-precheck
$(ACTIONS_ENDGROUP)
no-test-spec:
test-prism-spec: $(TEST_RUNNABLE)-test-prism-spec
yes-test-prism-spec: yes-test-spec-precheck
$(ACTIONS_GROUP)
$(gnumake_recursive)$(Q) \
$(RUNRUBY) -r./$(arch)-fake -r$(tooldir)/rubyspec_temp \
$(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec -B $(srcdir)/spec/prism.mspec $(MSPECOPT) $(SPECOPTS)
$(ACTIONS_ENDGROUP)
no-test-prism-spec:
check: $(DOT_WAIT) test-spec
RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable

66
spec/prism.mspec Normal file
View File

@ -0,0 +1,66 @@
# frozen_string_literal: true
## Command line
MSpec.register(:exclude, "The -S command line option runs launcher found in PATH, but only code after the first /#!.*ruby.*/-ish line in target file")
MSpec.register(:exclude, /^The -x command line option/)
MSpec.register(:exclude, "The --enable and --disable flags can be used with frozen-string-literal")
MSpec.register(:exclude, /^The --enable-frozen-string-literal flag/)
MSpec.register(:exclude, "The --debug flag produces debugging info on attempted frozen string modification")
## Language
MSpec.register(:exclude, "The BEGIN keyword runs multiple begins in FIFO order")
MSpec.register(:exclude, "Executing break from within a block works when passing through a super call")
MSpec.register(:exclude, "The defined? keyword when called with a method name in a void context warns about the void context when parsing it")
MSpec.register(:exclude, /^Hash literal expands an '\*\*\{\}'/)
MSpec.register(:exclude, "Hash literal merges multiple nested '**obj' in Hash literals")
MSpec.register(:exclude, /^Hash literal raises a SyntaxError at parse time when Symbol key with invalid bytes/)
MSpec.register(:exclude, "The next statement in a method is invalid and raises a SyntaxError")
MSpec.register(:exclude, "Pattern matching variable pattern does not support using variable name (except _) several times")
MSpec.register(:exclude, "Pattern matching Hash pattern raise SyntaxError when keys duplicate in pattern")
MSpec.register(:exclude, "Regexp with character classes supports [[:alpha:][:digit:][:etc:]] (predefined character classes)")
MSpec.register(:exclude, /^Regexps with encoding modifiers/)
MSpec.register(:exclude, "Regexps with grouping raises a SyntaxError when parentheses aren't balanced")
MSpec.register(:exclude, "Regexps with modifiers supports (?imx-imx) (inline modifiers)")
MSpec.register(:exclude, "Regexps with modifiers supports (?imx-imx:expr) (scoped inline modifiers)")
MSpec.register(:exclude, "Literal Regexps throws SyntaxError for malformed literals")
MSpec.register(:exclude, "The rescue keyword raises SyntaxError when else is used without rescue and ensure")
MSpec.register(:exclude, "A Symbol literal raises an SyntaxError at parse time when Symbol with invalid bytes")
## Core
MSpec.register(:exclude, "IO.popen with a leading Array argument accepts a trailing Hash of Process.exec options")
MSpec.register(:exclude, "IO.popen with a leading Array argument accepts an IO mode argument following the Array")
MSpec.register(:exclude, "Kernel#eval includes file and line information in syntax error")
MSpec.register(:exclude, "Kernel#eval evaluates string with given filename and negative linenumber")
MSpec.register(:exclude, "Kernel#eval with a magic encoding comment allows spaces before the magic encoding comment")
MSpec.register(:exclude, "Kernel#eval with a magic encoding comment allows a shebang line and some spaces before the magic encoding comment")
MSpec.register(:exclude, "Kernel#eval with a magic encoding comment ignores the frozen_string_literal magic comment if it appears after a token and warns if $VERBOSE is true")
MSpec.register(:exclude, "Regexp#source has US-ASCII encoding when created from an ASCII-only \\u{} literal")
MSpec.register(:exclude, "TracePoint#eval_script is the evald source code")
MSpec.register(:exclude, "TracePoint#event returns the type of event")
MSpec.register(:exclude, "TracePoint#inspect returns a String showing the event, method, path and line for a :return event")
MSpec.register(:exclude, "TracePoint#inspect returns a String showing the event, path and line for a :class event")
MSpec.register(:exclude, "TracePoint.new includes multiple events when multiple event names are passed as params")
MSpec.register(:exclude, "TracePoint#path equals \"(eval at __FILE__:__LINE__)\" inside an eval for :end event")
MSpec.register(:exclude, "TracePoint#self return the class object from a class event")
MSpec.register(:exclude, "Warning.[] returns default values for categories :deprecated and :experimental")
## Library
MSpec.register(:exclude, "Coverage.peek_result returns the result so far")
MSpec.register(:exclude, "Coverage.peek_result second call after require returns accumulated result")
MSpec.register(:exclude, "Coverage.result gives the covered files as a hash with arrays of count or nil")
MSpec.register(:exclude, "Coverage.result returns results for each mode separately when enabled :all modes")
MSpec.register(:exclude, "Coverage.result returns results for each mode separately when enabled any mode explicitly")
MSpec.register(:exclude, "Coverage.result returns the correct results when eval coverage is enabled")
MSpec.register(:exclude, "Coverage.result returns the correct results when eval coverage is disabled")
MSpec.register(:exclude, "Coverage.result clears counters (sets 0 values) when stop is not specified but clear: true specified")
MSpec.register(:exclude, "Coverage.result does not clear counters when stop is not specified but clear: false specified")
MSpec.register(:exclude, "Coverage.result does not clear counters when stop: false and clear is not specified")
MSpec.register(:exclude, "Coverage.result clears counters (sets 0 values) when stop: false and clear: true specified")
MSpec.register(:exclude, "Coverage.result does not clear counters when stop: false and clear: false specified")
MSpec.register(:exclude, "Coverage.start measures coverage within eval")
MSpec.register(:exclude, "Digest::SHA256.file when passed a path to a file that exists can be used with frozen-string-literal")
MSpec.register(:exclude, "ERB#filename raises an exception if there are errors processing content")
MSpec.register(:exclude, "ERB#filename uses '(erb)' as filename when filename is not set")
MSpec.register(:exclude, "mkmf can be required with --enable-frozen-string-literal")
MSpec.register(:exclude, "RbConfig::CONFIG contains no frozen strings even with --enable-frozen-string-literal")
MSpec.register(:exclude, "Socket.gethostbyaddr using an IPv6 address with an explicit address family raises SocketError when the address is not supported by the family")

View File

@ -6,7 +6,7 @@ describe "The -v command line option" do
describe "when used alone" do
it "prints version and ends" do
ruby_exe(nil, args: '-v').sub("+PRISM ", "").should include(RUBY_DESCRIPTION)
ruby_exe(nil, args: '-v').sub("+PRISM ", "").should include(RUBY_DESCRIPTION.sub("+PRISM ", ""))
end unless (defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?) ||
(defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?) ||
(ENV['RUBY_MN_THREADS'] == '1')

View File

@ -25,12 +25,12 @@ describe "Processing RUBYOPT" do
guard -> { not CROSS_COMPILING } do
it "prints the version number for '-v'" do
ENV["RUBYOPT"] = '-v'
ruby_exe("")[/\A.*/].should == RUBY_DESCRIPTION
ruby_exe("")[/\A.*/].should == RUBY_DESCRIPTION.sub("+PRISM ", "")
end
it "ignores whitespace around the option" do
ENV["RUBYOPT"] = ' -v '
ruby_exe("")[/\A.*/].should == RUBY_DESCRIPTION
ruby_exe("")[/\A.*/].should == RUBY_DESCRIPTION.sub("+PRISM ", "")
end
end