summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-02-16 17:33:39 +0900
committerYuichiro Kaneko <[email protected]>2024-02-20 17:33:58 +0900
commit2a4b6ed37cbb7acb622703be4db770457c2b72cc (patch)
tree6b16dc5cafa26704532b06a997415001b51ccc6b
parent20dbc7a5f4098ec7612192c2b65bdc970eab6055 (diff)
Workaround for `Prism::ParseTest#test_filepath` for "unparser/corpus/literal/def.txt"
See the discussion on https://github.com/ruby/ruby/pull/9923
-rw-r--r--parse.y10
-rw-r--r--test/prism/parse_test.rb2
2 files changed, 10 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 8ca4d78eae..284395ed7b 100644
--- a/parse.y
+++ b/parse.y
@@ -9412,7 +9412,17 @@ formal_argument(struct parser_params *p, ID id)
#undef ERR
}
shadowing_lvar(p, id);
+
+/*
+ * Workaround for Prism::ParseTest#test_filepath for "unparser/corpus/literal/def.txt"
+ *
+ * See the discussion on https://github.com/ruby/ruby/pull/9923
+ */
+#ifndef RIPPER
return id;
+#else
+ return 0;
+#endif
}
#ifdef RIPPER
diff --git a/test/prism/parse_test.rb b/test/prism/parse_test.rb
index 55b8c0178e..574a1c1714 100644
--- a/test/prism/parse_test.rb
+++ b/test/prism/parse_test.rb
@@ -207,8 +207,6 @@ module Prism
# https://bugs.ruby-lang.org/issues/19539
ripper_should_parse = false if relative == "heredocs_leading_whitespace.txt" && RUBY_VERSION < "3.3.0"
- ripper_should_parse = false if relative == "unparser/corpus/literal/def.txt"
-
define_method "test_filepath_#{relative}" do
# First, read the source from the filepath. Use binmode to avoid converting CRLF on Windows,
# and explicitly set the external encoding to UTF-8 to override the binmode default.