treetop spec testsuite fails with ruby3.2.0preview3 due to File.exists? removal
mtasaka opened this issue · comments
With ruby 3.2.0preview3, treetop spec testsuite fails like:
Failures:
1) Treetop::Compiler::GrammarCompiler compilation of a single file to a default file name
Got 0 failures and 2 other errors:
1.1) Failure/Error: File.delete(target_path) if File.exists?(target_path)
NoMethodError:
undefined method `exists?' for File:Class
# ./spec/compiler/grammar_compiler_spec.rb:108:in `delete_target_files'
# ./spec/compiler/grammar_compiler_spec.rb:22:in `block (2 levels) in <top (required)>'
1.2) Failure/Error: File.delete(target_path) if File.exists?(target_path)
NoMethodError:
undefined method `exists?' for File:Class
# ./spec/compiler/grammar_compiler_spec.rb:108:in `delete_target_files'
# ./spec/compiler/grammar_compiler_spec.rb:26:in `block (2 levels) in <top (required)>'
2) Treetop::Compiler::GrammarCompiler compilation of a single file to an explicit file name
Got 0 failures and 2 other errors:
2.1) Failure/Error: File.delete(target_path) if File.exists?(target_path)
NoMethodError:
undefined method `exists?' for File:Class
# ./spec/compiler/grammar_compiler_spec.rb:108:in `delete_target_files'
# ./spec/compiler/grammar_compiler_spec.rb:22:in `block (2 levels) in <top (required)>'
2.2) Failure/Error: File.delete(target_path) if File.exists?(target_path)
NoMethodError:
undefined method `exists?' for File:Class
# ./spec/compiler/grammar_compiler_spec.rb:108:in `delete_target_files'
# ./spec/compiler/grammar_compiler_spec.rb:26:in `block (2 levels) in <top (required)>'
(and many others)
Finished in 0.44989 seconds (files took 0.2466 seconds to load)
177 examples, 24 failures, 1 pending
Failed examples:
rspec ./spec/compiler/grammar_compiler_spec.rb:32 # Treetop::Compiler::GrammarCompiler compilation of a single file to a default file name
rspec ./spec/compiler/grammar_compiler_spec.rb:42 # Treetop::Compiler::GrammarCompiler compilation of a single file to an explicit file name
rspec ./spec/compiler/grammar_compiler_spec.rb:50 # Treetop::Compiler::GrammarCompiler compilation of a single file without writing it to an output file
rspec ./spec/compiler/grammar_compiler_spec.rb:54 # Treetop::Compiler::GrammarCompiler ruby_source_from_string compiles a grammar stored in string
rspec ./spec/compiler/grammar_compiler_spec.rb:58 # Treetop::Compiler::GrammarCompiler Treetop.load_from_string compiles and evaluates a source grammar stored in string
rspec ./spec/compiler/grammar_compiler_spec.rb:63 # Treetop::Compiler::GrammarCompiler Treetop.load compiles and evaluates a source grammar with a .treetop extension
rspec ./spec/compiler/grammar_compiler_spec.rb:68 # Treetop::Compiler::GrammarCompiler Treetop.load compiles and evaluates a source grammar with a .tt extension
rspec ./spec/compiler/grammar_compiler_spec.rb:75 # Treetop::Compiler::GrammarCompiler Treetop.load compiles and evaluates source grammar with no extension
rspec ./spec/compiler/grammar_compiler_spec.rb:81 # Treetop::Compiler::GrammarCompiler grammars with 'do' compile
rspec ./spec/compiler/grammar_compiler_spec.rb:89 # Treetop::Compiler::GrammarCompiler grammars with magic 'encoding' comments keep those comments at the top
rspec ./spec/compiler/grammar_compiler_spec.rb:98 # Treetop::Compiler::GrammarCompiler grammars with magic 'coding' comments keep those comments at the top
rspec ./spec/compiler/tt_compiler_spec.rb:35 # The 'tt' comand line compiler when processing a single grammar file can compile a grammar file
rspec ./spec/compiler/tt_compiler_spec.rb:43 # The 'tt' comand line compiler when processing a single grammar file can compile a relative pathed grammar file
rspec ./spec/compiler/tt_compiler_spec.rb:53 # The 'tt' comand line compiler when processing a single grammar file can compile an absolute pathed grammar file
rspec ./spec/compiler/tt_compiler_spec.rb:61 # The 'tt' comand line compiler when processing a single grammar file can compile without explicit file extensions
rspec ./spec/compiler/tt_compiler_spec.rb:69 # The 'tt' comand line compiler when processing a single grammar file skips nonexistent grammar file without failing or creating bogus output
rspec ./spec/compiler/tt_compiler_spec.rb:78 # The 'tt' comand line compiler when processing a single grammar file can compile to a specified parser source file
rspec ./spec/compiler/tt_compiler_spec.rb:91 # The 'tt' comand line compiler when processing a single grammar file by default, does not overwrite an existing file without an autogenerated header
rspec ./spec/compiler/tt_compiler_spec.rb:120 # The 'tt' comand line compiler when processing a single grammar file by default, overwrites a changed file with an intact autogenerated header
rspec ./spec/compiler/tt_compiler_spec.rb:140 # The 'tt' comand line compiler when processing a single grammar file can be forced to overwrite existing file #{@test_path}
rspec ./spec/compiler/tt_compiler_spec.rb:180 # The 'tt' comand line compiler when processing multiple grammar files can compile them in one invocation
rspec ./spec/compiler/tt_compiler_spec.rb:191 # The 'tt' comand line compiler when processing multiple grammar files can compile them without explicit file extenstions
rspec ./spec/compiler/tt_compiler_spec.rb:202 # The 'tt' comand line compiler when processing multiple grammar files can skip nonexistent and invalid extension named grammar files
rspec ./spec/compiler/tt_compiler_spec.rb:216 # The 'tt' comand line compiler when processing multiple grammar files can not specify an output file
File.exists?
has been deprecated since ruby2.1 and will be removed with ruby3.2:
https://github.com/ruby/ruby/blob/eaf2b6c4396ff19921cbc75a394d7a752aaab4ef/NEWS.md?plain=1#L305
https://bugs.ruby-lang.org/issues/17391