diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-02-28 15:48:17 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-02-29 16:29:16 +0000 |
| commit | cd8d1018bbca086427f66bdba646bb4f387c32b4 (patch) | |
| tree | b0a417da0ef4a00f73edbaed99a9ef36ba61e2b0 /test/prism | |
| parent | 5891c70b3839238433a47aa7c9b984a630b4b0db (diff) | |
[ruby/prism] Resync RBI and test it in CI
https://github.com/ruby/prism/commit/4ef4032774
Diffstat (limited to 'test/prism')
| -rw-r--r-- | test/prism/compiler_test.rb | 1 | ||||
| -rw-r--r-- | test/prism/ripper_test.rb | 18 |
2 files changed, 10 insertions, 9 deletions
diff --git a/test/prism/compiler_test.rb b/test/prism/compiler_test.rb index ed028d03d8..9a326eb8d6 100644 --- a/test/prism/compiler_test.rb +++ b/test/prism/compiler_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +# typed: ignore require_relative "test_helper" diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb index 9ff052ff04..a179116ce2 100644 --- a/test/prism/ripper_test.rb +++ b/test/prism/ripper_test.rb @@ -3,15 +3,13 @@ require_relative "test_helper" module Prism - class RipperTest < TestCase + class RipperTestCase < TestCase + private + def truffleruby? RUBY_ENGINE == "truffleruby" end - def windows? - Gem.win_platform? - end - # Ripper produces certain ambiguous structures. For instance, it often # adds an :args_add_block with "false" as the block meaning there is # no block call. It can be hard to tell which of multiple equivalent @@ -44,10 +42,9 @@ module Prism actual = normalized_sexp(actual) assert_equal expected, actual, "Expected Ripper and Prism to give equivalent output for #{path}!" end - end - class RipperShortSourceTest < RipperTest + class RipperShortSourceTest < RipperTestCase def test_binary assert_equivalent("1 + 2") assert_equivalent("3 - 4 * 5") @@ -258,13 +255,16 @@ module Prism assert_equivalent("alias :'' :foo") end + Translation::Ripper + RUBY_KEYWORDS = Translation.const_get(:RipperCompiler)::RUBY_KEYWORDS + # This is *exactly* the kind of thing where Ripper would have a weird # special case we didn't handle correctly. We're still testing with # a leading colon since putting random keywords there will often get # parse errors. Mostly we want to know that Ripper will use :@kw # instead of :@ident for the lexer symbol for all of these. def test_keyword_aliases - Prism::Translation::Ripper::RUBY_KEYWORDS.each do |keyword| + RUBY_KEYWORDS.each do |keyword| assert_equivalent("alias :foo :#{keyword}") end end @@ -276,7 +276,7 @@ module Prism end end - class RipperFixturesTest < RipperTest + class RipperFixturesTest < RipperTestCase #base = File.join(__dir__, "fixtures") #relatives = ENV["FOCUS"] ? [ENV["FOCUS"]] : Dir["**/*.txt", base: base] relatives = [ |
